1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_
6 #define UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_
10 // This table maps a DomCode to a printable character, assuming US layout.
11 // It is used by DomCodeToUsLayoutDomKey(), which provides a fallback
12 // interpretation when there is no other way to map a physical key.
13 const struct PrintableCodeEntry
{
15 base::char16 character
[2]; // normal, shift
16 } kPrintableCodeMap
[] = {
17 {DomCode::KEY_A
, {'a', 'A'}},
18 {DomCode::KEY_B
, {'b', 'B'}},
19 {DomCode::KEY_C
, {'c', 'C'}},
20 {DomCode::KEY_D
, {'d', 'D'}},
21 {DomCode::KEY_E
, {'e', 'E'}},
22 {DomCode::KEY_F
, {'f', 'F'}},
23 {DomCode::KEY_G
, {'g', 'G'}},
24 {DomCode::KEY_H
, {'h', 'H'}},
25 {DomCode::KEY_I
, {'i', 'I'}},
26 {DomCode::KEY_J
, {'j', 'J'}},
27 {DomCode::KEY_K
, {'k', 'K'}},
28 {DomCode::KEY_L
, {'l', 'L'}},
29 {DomCode::KEY_M
, {'m', 'M'}},
30 {DomCode::KEY_N
, {'n', 'N'}},
31 {DomCode::KEY_O
, {'o', 'O'}},
32 {DomCode::KEY_P
, {'p', 'P'}},
33 {DomCode::KEY_Q
, {'q', 'Q'}},
34 {DomCode::KEY_R
, {'r', 'R'}},
35 {DomCode::KEY_S
, {'s', 'S'}},
36 {DomCode::KEY_T
, {'t', 'T'}},
37 {DomCode::KEY_U
, {'u', 'U'}},
38 {DomCode::KEY_V
, {'v', 'V'}},
39 {DomCode::KEY_W
, {'w', 'W'}},
40 {DomCode::KEY_X
, {'x', 'X'}},
41 {DomCode::KEY_Y
, {'y', 'Y'}},
42 {DomCode::KEY_Z
, {'z', 'Z'}},
43 {DomCode::DIGIT1
, {'1', '!'}},
44 {DomCode::DIGIT2
, {'2', '@'}},
45 {DomCode::DIGIT3
, {'3', '#'}},
46 {DomCode::DIGIT4
, {'4', '$'}},
47 {DomCode::DIGIT5
, {'5', '%'}},
48 {DomCode::DIGIT6
, {'6', '^'}},
49 {DomCode::DIGIT7
, {'7', '&'}},
50 {DomCode::DIGIT8
, {'8', '*'}},
51 {DomCode::DIGIT9
, {'9', '('}},
52 {DomCode::DIGIT0
, {'0', ')'}},
53 {DomCode::SPACE
, {' ', ' '}},
54 {DomCode::MINUS
, {'-', '_'}},
55 {DomCode::EQUAL
, {'=', '+'}},
56 {DomCode::BRACKET_LEFT
, {'[', '{'}},
57 {DomCode::BRACKET_RIGHT
, {']', '}'}},
58 {DomCode::BACKSLASH
, {'\\', '|'}},
59 {DomCode::SEMICOLON
, {';', ':'}},
60 {DomCode::QUOTE
, {'\'', '"'}},
61 {DomCode::BACKQUOTE
, {'`', '~'}},
62 {DomCode::COMMA
, {',', '<'}},
63 {DomCode::PERIOD
, {'.', '>'}},
64 {DomCode::SLASH
, {'/', '?'}},
65 {DomCode::INTL_BACKSLASH
, {'<', '>'}},
66 {DomCode::INTL_HASH
, {'\\', '|'}},
67 {DomCode::INTL_YEN
, {0x00A5, '|'}},
68 {DomCode::NUMPAD_DIVIDE
, {'/', '/'}},
69 {DomCode::NUMPAD_MULTIPLY
, {'*', '*'}},
70 {DomCode::NUMPAD_SUBTRACT
, {'-', '-'}},
71 {DomCode::NUMPAD_ADD
, {'+', '+'}},
72 {DomCode::NUMPAD1
, {'1', '1'}},
73 {DomCode::NUMPAD2
, {'2', '2'}},
74 {DomCode::NUMPAD3
, {'3', '3'}},
75 {DomCode::NUMPAD4
, {'4', '4'}},
76 {DomCode::NUMPAD5
, {'5', '5'}},
77 {DomCode::NUMPAD6
, {'6', '6'}},
78 {DomCode::NUMPAD7
, {'7', '7'}},
79 {DomCode::NUMPAD8
, {'8', '8'}},
80 {DomCode::NUMPAD9
, {'9', '9'}},
81 {DomCode::NUMPAD0
, {'0', '0'}},
82 {DomCode::NUMPAD_DECIMAL
, {'.', '.'}},
83 {DomCode::NUMPAD_EQUAL
, {'=', '='}},
84 {DomCode::NUMPAD_COMMA
, {',', ','}},
85 {DomCode::NUMPAD_PAREN_LEFT
, {'(', '('}},
86 {DomCode::NUMPAD_PAREN_RIGHT
, {')', ')'}},
87 {DomCode::NUMPAD_SIGN_CHANGE
, {0x00B1, 0x00B1}},
90 // This table maps a DomCode to a DomKey, assuming US keyboard layout.
91 // It is used by DomCodeToUsLayoutDomKey(), which provides a fallback
92 // interpretation when there is no other way to map a physical key.
93 const struct NonPrintableCodeEntry
{
96 } kNonPrintableCodeMap
[] = {
97 {DomCode::ABORT
, DomKey::CANCEL
},
98 {DomCode::AGAIN
, DomKey::AGAIN
},
99 {DomCode::ALT_LEFT
, DomKey::ALT
},
100 {DomCode::ALT_RIGHT
, DomKey::ALT
},
101 {DomCode::ARROW_DOWN
, DomKey::ARROW_DOWN
},
102 {DomCode::ARROW_LEFT
, DomKey::ARROW_LEFT
},
103 {DomCode::ARROW_RIGHT
, DomKey::ARROW_RIGHT
},
104 {DomCode::ARROW_UP
, DomKey::ARROW_UP
},
105 {DomCode::BACKSPACE
, DomKey::BACKSPACE
},
106 {DomCode::BRIGHTNESS_DOWN
, DomKey::BRIGHTNESS_DOWN
},
107 {DomCode::BRIGHTNESS_UP
, DomKey::BRIGHTNESS_UP
},
108 // {DomCode::BRIGHTNESS_AUTO, DomKey::_}
109 // {DomCode::BRIGHTNESS_MAXIMUM, DomKey::_}
110 // {DomCode::BRIGHTNESS_MINIMIUM, DomKey::_}
111 // {DomCode::BRIGHTNESS_TOGGLE, DomKey::_}
112 {DomCode::BROWSER_BACK
, DomKey::BROWSER_BACK
},
113 {DomCode::BROWSER_FAVORITES
, DomKey::BROWSER_FAVORITES
},
114 {DomCode::BROWSER_FORWARD
, DomKey::BROWSER_FORWARD
},
115 {DomCode::BROWSER_HOME
, DomKey::BROWSER_HOME
},
116 {DomCode::BROWSER_REFRESH
, DomKey::BROWSER_REFRESH
},
117 {DomCode::BROWSER_SEARCH
, DomKey::BROWSER_SEARCH
},
118 {DomCode::BROWSER_STOP
, DomKey::BROWSER_STOP
},
119 {DomCode::CAPS_LOCK
, DomKey::CAPS_LOCK
},
120 {DomCode::CONTEXT_MENU
, DomKey::CONTEXT_MENU
},
121 {DomCode::CONTROL_LEFT
, DomKey::CONTROL
},
122 {DomCode::CONTROL_RIGHT
, DomKey::CONTROL
},
123 {DomCode::CONVERT
, DomKey::CONVERT
},
124 {DomCode::COPY
, DomKey::COPY
},
125 {DomCode::CUT
, DomKey::CUT
},
126 {DomCode::DEL
, DomKey::DEL
},
127 {DomCode::EJECT
, DomKey::EJECT
},
128 {DomCode::END
, DomKey::END
},
129 {DomCode::ENTER
, DomKey::ENTER
},
130 {DomCode::ESCAPE
, DomKey::ESCAPE
},
131 {DomCode::F1
, DomKey::F1
},
132 {DomCode::F2
, DomKey::F2
},
133 {DomCode::F3
, DomKey::F3
},
134 {DomCode::F4
, DomKey::F4
},
135 {DomCode::F5
, DomKey::F5
},
136 {DomCode::F6
, DomKey::F6
},
137 {DomCode::F7
, DomKey::F7
},
138 {DomCode::F8
, DomKey::F8
},
139 {DomCode::F9
, DomKey::F9
},
140 {DomCode::F10
, DomKey::F10
},
141 {DomCode::F11
, DomKey::F11
},
142 {DomCode::F12
, DomKey::F12
},
143 {DomCode::F13
, DomKey::F13
},
144 {DomCode::F14
, DomKey::F14
},
145 {DomCode::F15
, DomKey::F15
},
146 {DomCode::F16
, DomKey::F16
},
147 {DomCode::F17
, DomKey::F17
},
148 {DomCode::F18
, DomKey::F18
},
149 {DomCode::F19
, DomKey::F19
},
150 {DomCode::F20
, DomKey::F20
},
151 {DomCode::F21
, DomKey::F21
},
152 {DomCode::F22
, DomKey::F22
},
153 {DomCode::F23
, DomKey::F23
},
154 {DomCode::F24
, DomKey::F24
},
155 {DomCode::FIND
, DomKey::FIND
},
156 {DomCode::FN
, DomKey::FN
},
157 {DomCode::FN_LOCK
, DomKey::FN_LOCK
},
158 {DomCode::HELP
, DomKey::HELP
},
159 {DomCode::HOME
, DomKey::HOME
},
160 {DomCode::HYPER
, DomKey::HYPER
},
161 {DomCode::INSERT
, DomKey::INSERT
},
162 // {DomCode::INTL_RO, DomKey::_}
163 {DomCode::KANA_MODE
, DomKey::KANA_MODE
},
164 {DomCode::LANG1
, DomKey::HANGUL_MODE
},
165 {DomCode::LANG2
, DomKey::HANJA_MODE
},
166 {DomCode::LANG3
, DomKey::KATAKANA
},
167 {DomCode::LANG4
, DomKey::HIRAGANA
},
168 {DomCode::LANG5
, DomKey::ZENKAKU_HANKAKU
},
169 {DomCode::LAUNCH_APP1
, DomKey::LAUNCH_MY_COMPUTER
},
170 {DomCode::LAUNCH_APP2
, DomKey::LAUNCH_CALCULATOR
},
171 {DomCode::LAUNCH_MAIL
, DomKey::LAUNCH_MAIL
},
172 {DomCode::LAUNCH_SCREEN_SAVER
, DomKey::LAUNCH_SCREEN_SAVER
},
173 // {DomCode::LAUNCH_DOCUMENTS, DomKey::_}
174 // {DomCode::LAUNCH_FILE_BROWSER, DomKey::_}
175 // {DomCode::LAUNCH_KEYBOARD_LAYOUT, DomKey::_}
176 {DomCode::LOCK_SCREEN
, DomKey::LAUNCH_SCREEN_SAVER
},
177 {DomCode::MAIL_FORWARD
, DomKey::MAIL_FORWARD
},
178 {DomCode::MAIL_REPLY
, DomKey::MAIL_REPLY
},
179 {DomCode::MAIL_SEND
, DomKey::MAIL_SEND
},
180 {DomCode::MEDIA_PLAY_PAUSE
, DomKey::MEDIA_PLAY_PAUSE
},
181 {DomCode::MEDIA_SELECT
, DomKey::MEDIA_SELECT
},
182 {DomCode::MEDIA_STOP
, DomKey::MEDIA_STOP
},
183 {DomCode::MEDIA_TRACK_NEXT
, DomKey::MEDIA_TRACK_NEXT
},
184 {DomCode::MEDIA_TRACK_PREVIOUS
, DomKey::MEDIA_TRACK_PREVIOUS
},
185 // {DomCode::MENU, DomKey::_}
186 {DomCode::NON_CONVERT
, DomKey::NON_CONVERT
},
187 {DomCode::NUM_LOCK
, DomKey::NUM_LOCK
},
188 {DomCode::NUMPAD_BACKSPACE
, DomKey::BACKSPACE
},
189 {DomCode::NUMPAD_CLEAR
, DomKey::CLEAR
},
190 {DomCode::NUMPAD_ENTER
, DomKey::ENTER
},
191 // {DomCode::NUMPAD_CLEAR_ENTRY, DomKey::_}
192 // {DomCode::NUMPAD_MEMORY_ADD, DomKey::_}
193 // {DomCode::NUMPAD_MEMORY_CLEAR, DomKey::_}
194 // {DomCode::NUMPAD_MEMORY_RECALL, DomKey::_}
195 // {DomCode::NUMPAD_MEMORY_STORE, DomKey::_}
196 // {DomCode::NUMPAD_MEMORY_SUBTRACT, DomKey::_}
197 {DomCode::OPEN
, DomKey::OPEN
},
198 {DomCode::OS_LEFT
, DomKey::OS
},
199 {DomCode::OS_RIGHT
, DomKey::OS
},
200 {DomCode::PAGE_DOWN
, DomKey::PAGE_DOWN
},
201 {DomCode::PAGE_UP
, DomKey::PAGE_UP
},
202 {DomCode::PASTE
, DomKey::PASTE
},
203 {DomCode::PAUSE
, DomKey::PAUSE
},
204 {DomCode::POWER
, DomKey::POWER
},
205 {DomCode::PRINT_SCREEN
, DomKey::PRINT_SCREEN
},
206 {DomCode::PROPS
, DomKey::PROPS
},
207 {DomCode::SCROLL_LOCK
, DomKey::SCROLL_LOCK
},
208 {DomCode::SELECT
, DomKey::SELECT
},
209 // {DomCode::SELECT_TASK, DomKey::_}
210 {DomCode::SHIFT_LEFT
, DomKey::SHIFT
},
211 {DomCode::SHIFT_RIGHT
, DomKey::SHIFT
},
212 {DomCode::SUPER
, DomKey::SUPER
},
213 {DomCode::TAB
, DomKey::TAB
},
214 {DomCode::UNDO
, DomKey::UNDO
},
215 // {DomCode::VOICE_COMMAND, DomKey::_}
216 {DomCode::VOLUME_DOWN
, DomKey::VOLUME_DOWN
},
217 {DomCode::VOLUME_MUTE
, DomKey::VOLUME_MUTE
},
218 {DomCode::VOLUME_UP
, DomKey::VOLUME_UP
},
219 {DomCode::WAKE_UP
, DomKey::WAKE_UP
},
220 {DomCode::ZOOM_TOGGLE
, DomKey::ZOOM_TOGGLE
},
223 // This table maps a DomKey to a non-located KeyboardCode.
224 const struct DomKeyToKeyboardCodeEntry
{
225 DomKey::Base dom_key
;
226 KeyboardCode key_code
;
227 } kDomKeyToKeyboardCodeMap
[] = {
229 {DomKey::NONE
, VKEY_UNKNOWN
},
230 // Special Key Values
231 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-special
232 {DomKey::UNIDENTIFIED
, VKEY_UNKNOWN
},
234 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-modifier
235 {DomKey::ALT
, VKEY_MENU
},
236 {DomKey::ALT_GRAPH
, VKEY_ALTGR
},
237 {DomKey::CAPS_LOCK
, VKEY_CAPITAL
},
238 {DomKey::CONTROL
, VKEY_CONTROL
},
239 {DomKey::NUM_LOCK
, VKEY_NUMLOCK
},
240 {DomKey::OS
, VKEY_LWIN
},
241 {DomKey::SCROLL_LOCK
, VKEY_SCROLL
},
242 {DomKey::SHIFT
, VKEY_SHIFT
},
244 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-whitespace
245 {DomKey::ENTER
, VKEY_RETURN
},
246 {DomKey::SEPARATOR
, VKEY_SEPARATOR
},
247 {DomKey::TAB
, VKEY_TAB
},
249 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-navigation
250 {DomKey::ARROW_DOWN
, VKEY_DOWN
},
251 {DomKey::ARROW_LEFT
, VKEY_LEFT
},
252 {DomKey::ARROW_RIGHT
, VKEY_RIGHT
},
253 {DomKey::ARROW_UP
, VKEY_UP
},
254 {DomKey::END
, VKEY_END
},
255 {DomKey::HOME
, VKEY_HOME
},
256 {DomKey::PAGE_DOWN
, VKEY_NEXT
},
257 {DomKey::PAGE_UP
, VKEY_PRIOR
},
259 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-editing
260 {DomKey::BACKSPACE
, VKEY_BACK
},
261 {DomKey::CLEAR
, VKEY_CLEAR
},
262 {DomKey::CR_SEL
, VKEY_CRSEL
},
263 {DomKey::DEL
, VKEY_DELETE
},
264 {DomKey::ERASE_EOF
, VKEY_EREOF
},
265 {DomKey::EX_SEL
, VKEY_EXSEL
},
266 {DomKey::INSERT
, VKEY_INSERT
},
268 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-ui
269 {DomKey::ACCEPT
, VKEY_ACCEPT
},
270 {DomKey::ATTN
, VKEY_ATTN
},
271 {DomKey::CONTEXT_MENU
, VKEY_APPS
},
272 {DomKey::ESCAPE
, VKEY_ESCAPE
},
273 {DomKey::EXECUTE
, VKEY_EXECUTE
},
274 {DomKey::HELP
, VKEY_HELP
},
275 {DomKey::PAUSE
, VKEY_PAUSE
},
276 {DomKey::PLAY
, VKEY_PLAY
},
277 {DomKey::SELECT
, VKEY_SELECT
},
279 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-device
280 #if defined(OS_POSIX)
281 {DomKey::BRIGHTNESS_DOWN
, VKEY_BRIGHTNESS_DOWN
},
282 {DomKey::BRIGHTNESS_UP
, VKEY_BRIGHTNESS_UP
},
283 {DomKey::POWER
, VKEY_POWER
},
285 {DomKey::PRINT_SCREEN
, VKEY_SNAPSHOT
},
286 // IME and Composition Keys
287 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-composition
288 #if defined(OS_POSIX)
289 {DomKey::COMPOSE
, VKEY_COMPOSE
},
291 {DomKey::CONVERT
, VKEY_CONVERT
},
292 {DomKey::FINAL_MODE
, VKEY_FINAL
},
293 {DomKey::MODE_CHANGE
, VKEY_MODECHANGE
},
294 {DomKey::NON_CONVERT
, VKEY_NONCONVERT
},
295 {DomKey::PROCESS
, VKEY_PROCESSKEY
},
296 // Keys specific to Korean keyboards
297 {DomKey::HANGUL_MODE
, VKEY_HANGUL
},
298 {DomKey::HANJA_MODE
, VKEY_HANJA
},
299 {DomKey::JUNJA_MODE
, VKEY_JUNJA
},
300 // Keys specific to Japanese keyboards
301 {DomKey::HANKAKU
, VKEY_DBE_SBCSCHAR
},
302 {DomKey::KANA_MODE
, VKEY_KANA
},
303 {DomKey::KANJI_MODE
, VKEY_KANJI
},
304 {DomKey::ZENKAKU
, VKEY_DBE_DBCSCHAR
},
305 {DomKey::ZENKAKU_HANKAKU
, VKEY_DBE_DBCSCHAR
},
306 // General-Purpose Function Keys
307 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-function
308 {DomKey::F1
, VKEY_F1
},
309 {DomKey::F2
, VKEY_F2
},
310 {DomKey::F3
, VKEY_F3
},
311 {DomKey::F4
, VKEY_F4
},
312 {DomKey::F5
, VKEY_F5
},
313 {DomKey::F6
, VKEY_F6
},
314 {DomKey::F7
, VKEY_F7
},
315 {DomKey::F8
, VKEY_F8
},
316 {DomKey::F9
, VKEY_F9
},
317 {DomKey::F10
, VKEY_F10
},
318 {DomKey::F11
, VKEY_F11
},
319 {DomKey::F12
, VKEY_F12
},
320 {DomKey::F13
, VKEY_F13
},
321 {DomKey::F14
, VKEY_F14
},
322 {DomKey::F15
, VKEY_F15
},
323 {DomKey::F16
, VKEY_F16
},
324 {DomKey::F17
, VKEY_F17
},
325 {DomKey::F18
, VKEY_F18
},
326 {DomKey::F19
, VKEY_F19
},
327 {DomKey::F20
, VKEY_F20
},
328 {DomKey::F21
, VKEY_F21
},
329 {DomKey::F22
, VKEY_F22
},
330 {DomKey::F23
, VKEY_F23
},
331 {DomKey::F24
, VKEY_F24
},
333 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-multimedia
334 {DomKey::MEDIA_PLAY_PAUSE
, VKEY_MEDIA_PLAY_PAUSE
},
335 {DomKey::MEDIA_SELECT
, VKEY_MEDIA_LAUNCH_MEDIA_SELECT
},
336 {DomKey::MEDIA_STOP
, VKEY_MEDIA_STOP
},
337 {DomKey::MEDIA_TRACK_NEXT
, VKEY_MEDIA_NEXT_TRACK
},
338 {DomKey::MEDIA_TRACK_PREVIOUS
, VKEY_MEDIA_PREV_TRACK
},
339 {DomKey::PRINT
, VKEY_PRINT
},
340 {DomKey::VOLUME_DOWN
, VKEY_VOLUME_DOWN
},
341 {DomKey::VOLUME_MUTE
, VKEY_VOLUME_MUTE
},
342 {DomKey::VOLUME_UP
, VKEY_VOLUME_UP
},
344 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-apps
345 {DomKey::LAUNCH_CALCULATOR
, VKEY_MEDIA_LAUNCH_APP2
},
346 {DomKey::LAUNCH_MAIL
, VKEY_MEDIA_LAUNCH_MAIL
},
347 {DomKey::LAUNCH_MY_COMPUTER
, VKEY_MEDIA_LAUNCH_APP1
},
349 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-browser
350 {DomKey::BROWSER_BACK
, VKEY_BROWSER_BACK
},
351 {DomKey::BROWSER_FAVORITES
, VKEY_BROWSER_FAVORITES
},
352 {DomKey::BROWSER_FORWARD
, VKEY_BROWSER_FORWARD
},
353 {DomKey::BROWSER_HOME
, VKEY_BROWSER_HOME
},
354 {DomKey::BROWSER_REFRESH
, VKEY_BROWSER_REFRESH
},
355 {DomKey::BROWSER_SEARCH
, VKEY_BROWSER_SEARCH
},
356 {DomKey::BROWSER_STOP
, VKEY_BROWSER_STOP
},
357 // Media Controller Keys
358 // http://www.w3.org/TR/DOM-Level-3-Events-key/#keys-media-controller
359 #if defined(OS_POSIX)
360 {DomKey::MEDIA_FAST_FORWARD
, VKEY_OEM_104
},
362 {DomKey::MEDIA_PLAY
, VKEY_PLAY
},
363 #if defined(OS_POSIX)
364 {DomKey::MEDIA_REWIND
, VKEY_OEM_103
},
366 {DomKey::ZOOM_TOGGLE
, VKEY_ZOOM
},
369 // This table, used by DomCodeToUsLayoutKeyboardCode() and
370 // UsLayoutKeyboardCodeToDomCode(), maps between DOM Level 3 .code values
371 // and legacy Windows-based VKEY values, where the VKEYs are interpreted
372 // positionally (located) following a base US English layout.
373 const struct DomCodeToKeyboardCodeEntry
{
375 KeyboardCode key_code
;
376 } kDomCodeToKeyboardCodeMap
[] = {
377 // Entries are ordered by numeric value of the DomCode enum,
378 // which is the USB physical key code.
379 // DomCode::HYPER 0x000010 Hyper
380 // DomCode::SUPER 0x000011 Super
381 // DomCode::FN 0x000012 Fn
382 // DomCode::FN_LOCK 0x000013 FLock
383 // DomCode::SUSPEND 0x000014 Suspend
384 // DomCode::RESUME 0x000015 Resume
385 // DomCode::TURBO 0x000016 Turbo
386 {DomCode::SLEEP
, VKEY_SLEEP
}, // 0x010082 Sleep
387 // DomCode::WAKE_UP 0x010083 WakeUp
388 {DomCode::KEY_A
, VKEY_A
}, // 0x070004 KeyA
389 {DomCode::KEY_B
, VKEY_B
}, // 0x070005 KeyB
390 {DomCode::KEY_C
, VKEY_C
}, // 0x070006 KeyC
391 {DomCode::KEY_D
, VKEY_D
}, // 0x070007 KeyD
392 {DomCode::KEY_E
, VKEY_E
}, // 0x070008 KeyE
393 {DomCode::KEY_F
, VKEY_F
}, // 0x070009 KeyF
394 {DomCode::KEY_G
, VKEY_G
}, // 0x07000A KeyG
395 {DomCode::KEY_H
, VKEY_H
}, // 0x07000B KeyH
396 {DomCode::KEY_I
, VKEY_I
}, // 0x07000C KeyI
397 {DomCode::KEY_J
, VKEY_J
}, // 0x07000D KeyJ
398 {DomCode::KEY_K
, VKEY_K
}, // 0x07000E KeyK
399 {DomCode::KEY_L
, VKEY_L
}, // 0x07000F KeyL
400 {DomCode::KEY_M
, VKEY_M
}, // 0x070010 KeyM
401 {DomCode::KEY_N
, VKEY_N
}, // 0x070011 KeyN
402 {DomCode::KEY_O
, VKEY_O
}, // 0x070012 KeyO
403 {DomCode::KEY_P
, VKEY_P
}, // 0x070013 KeyP
404 {DomCode::KEY_Q
, VKEY_Q
}, // 0x070014 KeyQ
405 {DomCode::KEY_R
, VKEY_R
}, // 0x070015 KeyR
406 {DomCode::KEY_S
, VKEY_S
}, // 0x070016 KeyS
407 {DomCode::KEY_T
, VKEY_T
}, // 0x070017 KeyT
408 {DomCode::KEY_U
, VKEY_U
}, // 0x070018 KeyU
409 {DomCode::KEY_V
, VKEY_V
}, // 0x070019 KeyV
410 {DomCode::KEY_W
, VKEY_W
}, // 0x07001A KeyW
411 {DomCode::KEY_X
, VKEY_X
}, // 0x07001B KeyX
412 {DomCode::KEY_Y
, VKEY_Y
}, // 0x07001C KeyY
413 {DomCode::KEY_Z
, VKEY_Z
}, // 0x07001D KeyZ
414 {DomCode::DIGIT1
, VKEY_1
}, // 0x07001E Digit1
415 {DomCode::DIGIT2
, VKEY_2
}, // 0x07001F Digit2
416 {DomCode::DIGIT3
, VKEY_3
}, // 0x070020 Digit3
417 {DomCode::DIGIT4
, VKEY_4
}, // 0x070021 Digit4
418 {DomCode::DIGIT5
, VKEY_5
}, // 0x070022 Digit5
419 {DomCode::DIGIT6
, VKEY_6
}, // 0x070023 Digit6
420 {DomCode::DIGIT7
, VKEY_7
}, // 0x070024 Digit7
421 {DomCode::DIGIT8
, VKEY_8
}, // 0x070025 Digit8
422 {DomCode::DIGIT9
, VKEY_9
}, // 0x070026 Digit9
423 {DomCode::DIGIT0
, VKEY_0
}, // 0x070027 Digit0
424 {DomCode::ENTER
, VKEY_RETURN
}, // 0x070028 Enter
425 {DomCode::ESCAPE
, VKEY_ESCAPE
}, // 0x070029 Escape
426 {DomCode::BACKSPACE
, VKEY_BACK
}, // 0x07002A Backspace
427 {DomCode::TAB
, VKEY_TAB
}, // 0x07002B Tab
428 {DomCode::SPACE
, VKEY_SPACE
}, // 0x07002C Space
429 {DomCode::MINUS
, VKEY_OEM_MINUS
}, // 0x07002D Minus
430 {DomCode::EQUAL
, VKEY_OEM_PLUS
}, // 0x07002E Equal
431 {DomCode::BRACKET_LEFT
, VKEY_OEM_4
}, // 0x07002F BracketLeft
432 {DomCode::BRACKET_RIGHT
, VKEY_OEM_6
}, // 0x070030 BracketRight
433 {DomCode::BACKSLASH
, VKEY_OEM_5
}, // 0x070031 Backslash
434 {DomCode::INTL_HASH
, VKEY_OEM_5
}, // 0x070032 IntlHash
435 {DomCode::SEMICOLON
, VKEY_OEM_1
}, // 0x070033 Semicolon
436 {DomCode::QUOTE
, VKEY_OEM_7
}, // 0x070034 Quote
437 {DomCode::BACKQUOTE
, VKEY_OEM_3
}, // 0x070035 Backquote
438 {DomCode::COMMA
, VKEY_OEM_COMMA
}, // 0x070036 Comma
439 {DomCode::PERIOD
, VKEY_OEM_PERIOD
}, // 0x070037 Period
440 {DomCode::SLASH
, VKEY_OEM_2
}, // 0x070038 Slash
441 {DomCode::CAPS_LOCK
, VKEY_CAPITAL
}, // 0x070039 CapsLock
442 {DomCode::F1
, VKEY_F1
}, // 0x07003A F1
443 {DomCode::F2
, VKEY_F2
}, // 0x07003B F2
444 {DomCode::F3
, VKEY_F3
}, // 0x07003C F3
445 {DomCode::F4
, VKEY_F4
}, // 0x07003D F4
446 {DomCode::F5
, VKEY_F5
}, // 0x07003E F5
447 {DomCode::F6
, VKEY_F6
}, // 0x07003F F6
448 {DomCode::F7
, VKEY_F7
}, // 0x070040 F7
449 {DomCode::F8
, VKEY_F8
}, // 0x070041 F8
450 {DomCode::F9
, VKEY_F9
}, // 0x070042 F9
451 {DomCode::F10
, VKEY_F10
}, // 0x070043 F10
452 {DomCode::F11
, VKEY_F11
}, // 0x070044 F11
453 {DomCode::F12
, VKEY_F12
}, // 0x070045 F12
454 {DomCode::PRINT_SCREEN
, VKEY_SNAPSHOT
}, // 0x070046 PrintScreen
455 {DomCode::SCROLL_LOCK
, VKEY_SCROLL
}, // 0x070047 ScrollLock
456 {DomCode::PAUSE
, VKEY_PAUSE
}, // 0x070048 Pause
457 {DomCode::INSERT
, VKEY_INSERT
}, // 0x070049 Insert
458 {DomCode::HOME
, VKEY_HOME
}, // 0x07004A Home
459 {DomCode::PAGE_UP
, VKEY_PRIOR
}, // 0x07004B PageUp
460 {DomCode::DEL
, VKEY_DELETE
}, // 0x07004C Delete
461 {DomCode::END
, VKEY_END
}, // 0x07004D End
462 {DomCode::PAGE_DOWN
, VKEY_NEXT
}, // 0x07004E PageDown
463 {DomCode::ARROW_RIGHT
, VKEY_RIGHT
}, // 0x07004F ArrowRight
464 {DomCode::ARROW_LEFT
, VKEY_LEFT
}, // 0x070050 ArrowLeft
465 {DomCode::ARROW_DOWN
, VKEY_DOWN
}, // 0x070051 ArrowDown
466 {DomCode::ARROW_UP
, VKEY_UP
}, // 0x070052 ArrowUp
467 {DomCode::NUM_LOCK
, VKEY_NUMLOCK
}, // 0x070053 NumLock
468 {DomCode::NUMPAD_DIVIDE
, VKEY_DIVIDE
}, // 0x070054 NumpadDivide
469 {DomCode::NUMPAD_MULTIPLY
, VKEY_MULTIPLY
}, // 0x070055 NumpadMultiply
470 {DomCode::NUMPAD_SUBTRACT
, VKEY_SUBTRACT
}, // 0x070056 NumpadSubtract
471 {DomCode::NUMPAD_ADD
, VKEY_ADD
}, // 0x070057 NumpadAdd
472 {DomCode::NUMPAD_ENTER
, VKEY_RETURN
}, // 0x070058 NumpadEnter
473 {DomCode::NUMPAD1
, VKEY_NUMPAD1
}, // 0x070059 Numpad1
474 {DomCode::NUMPAD2
, VKEY_NUMPAD2
}, // 0x07005A Numpad2
475 {DomCode::NUMPAD3
, VKEY_NUMPAD3
}, // 0x07005B Numpad3
476 {DomCode::NUMPAD4
, VKEY_NUMPAD4
}, // 0x07005C Numpad4
477 {DomCode::NUMPAD5
, VKEY_NUMPAD5
}, // 0x07005D Numpad5
478 {DomCode::NUMPAD6
, VKEY_NUMPAD6
}, // 0x07005E Numpad6
479 {DomCode::NUMPAD7
, VKEY_NUMPAD7
}, // 0x07005F Numpad7
480 {DomCode::NUMPAD8
, VKEY_NUMPAD8
}, // 0x070060 Numpad8
481 {DomCode::NUMPAD9
, VKEY_NUMPAD9
}, // 0x070061 Numpad9
482 {DomCode::NUMPAD0
, VKEY_NUMPAD0
}, // 0x070062 Numpad0
483 {DomCode::NUMPAD_DECIMAL
, VKEY_DECIMAL
}, // 0x070063 NumpadDecimal
484 {DomCode::INTL_BACKSLASH
, VKEY_OEM_102
}, // 0x070064 IntlBackslash
485 {DomCode::CONTEXT_MENU
, VKEY_APPS
}, // 0x070065 ContextMenu
486 #if defined(OS_POSIX)
487 {DomCode::POWER
, VKEY_POWER
}, // 0x070066 Power
489 // DomCode::NUMPAD_EQUAL 0x070067 NumpadEqual
490 {DomCode::F13
, VKEY_F13
}, // 0x070068 F13
491 {DomCode::F14
, VKEY_F14
}, // 0x070069 F14
492 {DomCode::F15
, VKEY_F15
}, // 0x07006A F15
493 {DomCode::F16
, VKEY_F16
}, // 0x07006B F16
494 {DomCode::F17
, VKEY_F17
}, // 0x07006C F17
495 {DomCode::F18
, VKEY_F18
}, // 0x07006D F18
496 {DomCode::F19
, VKEY_F19
}, // 0x07006E F19
497 {DomCode::F20
, VKEY_F20
}, // 0x07006F F20
498 {DomCode::F21
, VKEY_F21
}, // 0x070070 F21
499 {DomCode::F22
, VKEY_F22
}, // 0x070071 F22
500 {DomCode::F23
, VKEY_F23
}, // 0x070072 F23
501 {DomCode::F24
, VKEY_F24
}, // 0x070073 F24
502 {DomCode::OPEN
, VKEY_EXECUTE
}, // 0x070074 Open
503 {DomCode::HELP
, VKEY_HELP
}, // 0x070075 Help
504 {DomCode::SELECT
, VKEY_SELECT
}, // 0x070077 Select
505 // DomCode::AGAIN 0x070079 Again
506 // DomCode::UNDO 0x07007A Undo
507 // DomCode::CUT 0x07007B Cut
508 // DomCode::COPY 0x07007C Copy
509 // DomCode::PASTE 0x07007D Paste
510 // DomCode::FIND 0x07007E Find
511 {DomCode::VOLUME_MUTE
, VKEY_VOLUME_MUTE
}, // 0x07007F VolumeMute
512 {DomCode::VOLUME_UP
, VKEY_VOLUME_UP
}, // 0x070080 VolumeUp
513 {DomCode::VOLUME_DOWN
, VKEY_VOLUME_DOWN
}, // 0x070081 VolumeDown
514 {DomCode::NUMPAD_COMMA
, VKEY_OEM_COMMA
}, // 0x070085 NumpadComma
515 {DomCode::INTL_RO
, VKEY_OEM_102
}, // 0x070087 IntlRo
516 {DomCode::KANA_MODE
, VKEY_KANA
}, // 0x070088 KanaMode
517 {DomCode::INTL_YEN
, VKEY_OEM_5
}, // 0x070089 IntlYen
518 {DomCode::CONVERT
, VKEY_CONVERT
}, // 0x07008A Convert
519 {DomCode::NON_CONVERT
, VKEY_NONCONVERT
}, // 0x07008B NonConvert
520 {DomCode::LANG1
, VKEY_KANA
}, // 0x070090 Lang1
521 {DomCode::LANG2
, VKEY_KANJI
}, // 0x070091 Lang2
522 // DomCode::LANG3 0x070092 Lang3
523 // DomCode::LANG4 0x070093 Lang4
524 // DomCode::LANG5 0x070094 Lang5
525 // DomCode::ABORT 0x07009B Abort
526 // DomCode::PROPS 0x0700A3 Props
527 // DomCode::NUMPAD_PAREN_LEFT 0x0700B6 NumpadParenLeft
528 // DomCode::NUMPAD_PAREN_RIGHT 0x0700B7 NumpadParenRight
529 {DomCode::NUMPAD_BACKSPACE
, VKEY_BACK
}, // 0x0700BB NumpadBackspace
530 // DomCode::NUMPAD_MEMORY_STORE 0x0700D0 NumpadMemoryStore
531 // DomCode::NUMPAD_MEMORY_RECALL 0x0700D1 NumpadMemoryRecall
532 // DomCode::NUMPAD_MEMORY_CLEAR 0x0700D2 NumpadMemoryClear
533 // DomCode::NUMPAD_MEMORY_ADD 0x0700D3 NumpadMemoryAdd
534 // DomCode::NUMPAD_MEMORY_SUBTRACT 0x0700D4 NumpadMemorySubtract
535 {DomCode::NUMPAD_CLEAR
, VKEY_CLEAR
}, // 0x0700D8 NumpadClear
536 {DomCode::NUMPAD_CLEAR_ENTRY
, VKEY_CLEAR
}, // 0x0700D9 NumpadClearEntry
537 {DomCode::CONTROL_LEFT
, VKEY_LCONTROL
}, // 0x0700E0 ControlLeft
538 {DomCode::SHIFT_LEFT
, VKEY_LSHIFT
}, // 0x0700E1 ShiftLeft
539 {DomCode::ALT_LEFT
, VKEY_LMENU
}, // 0x0700E2 AltLeft
540 {DomCode::OS_LEFT
, VKEY_LWIN
}, // 0x0700E3 OSLeft
541 {DomCode::CONTROL_RIGHT
, VKEY_RCONTROL
}, // 0x0700E4 ControlRight
542 {DomCode::SHIFT_RIGHT
, VKEY_RSHIFT
}, // 0x0700E5 ShiftRight
543 {DomCode::ALT_RIGHT
, VKEY_RMENU
}, // 0x0700E6 AltRight
544 {DomCode::OS_RIGHT
, VKEY_RWIN
}, // 0x0700E7 OSRight
545 #if defined(OS_POSIX)
546 {DomCode::BRIGHTNESS_UP
,
547 VKEY_BRIGHTNESS_UP
}, // 0x0C006F BrightnessUp
548 {DomCode::BRIGHTNESS_DOWN
,
549 VKEY_BRIGHTNESS_DOWN
}, // 0x0C0070 BrightnessDown
551 {DomCode::MEDIA_TRACK_NEXT
,
552 VKEY_MEDIA_NEXT_TRACK
}, // 0x0C00B5 MediaTrackNext
553 {DomCode::MEDIA_TRACK_PREVIOUS
,
554 VKEY_MEDIA_PREV_TRACK
}, // 0x0C00B6 MediaTrackPrevious
555 {DomCode::MEDIA_STOP
, VKEY_MEDIA_STOP
}, // 0x0C00B7 MediaStop
556 // DomCode::EJECT 0x0C00B8 Eject
557 {DomCode::MEDIA_PLAY_PAUSE
,
558 VKEY_MEDIA_PLAY_PAUSE
}, // 0x0C00CD MediaPlayPause
559 {DomCode::MEDIA_SELECT
,
560 VKEY_MEDIA_LAUNCH_MEDIA_SELECT
}, // 0x0C0183 MediaSelect
561 {DomCode::LAUNCH_MAIL
,
562 VKEY_MEDIA_LAUNCH_MAIL
}, // 0x0C018A LaunchMail
563 {DomCode::LAUNCH_APP2
,
564 VKEY_MEDIA_LAUNCH_APP2
}, // 0x0C0192 LaunchApp2
565 {DomCode::LAUNCH_APP1
,
566 VKEY_MEDIA_LAUNCH_APP1
}, // 0x0C0194 LaunchApp1
567 {DomCode::BROWSER_SEARCH
,
568 VKEY_BROWSER_SEARCH
}, // 0x0C0221 BrowserSearch
569 {DomCode::BROWSER_HOME
, VKEY_BROWSER_HOME
}, // 0x0C0223 BrowserHome
570 {DomCode::BROWSER_BACK
, VKEY_BROWSER_BACK
}, // 0x0C0224 BrowserBack
571 {DomCode::BROWSER_FORWARD
,
572 VKEY_BROWSER_FORWARD
}, // 0x0C0225 BrowserForward
573 {DomCode::BROWSER_STOP
, VKEY_BROWSER_STOP
}, // 0x0C0226 BrowserStop
574 {DomCode::BROWSER_REFRESH
,
575 VKEY_BROWSER_REFRESH
}, // 0x0C0227 BrowserRefresh
576 {DomCode::BROWSER_FAVORITES
,
577 VKEY_BROWSER_FAVORITES
}, // 0x0C022A BrowserFavorites
578 {DomCode::ZOOM_TOGGLE
, VKEY_ZOOM
}, // 0x0C0232 ZoomToggle
581 // This table, used by UsLayoutKeyboardCodeToDomCode(), maps legacy
582 // Windows-based VKEY values that are not part of kDomCodeToKeyboardCodeMap[]
583 // to suitable DomCode values, where practical.
584 const DomCodeToKeyboardCodeEntry kFallbackKeyboardCodeToDomCodeMap
[] = {
585 {DomCode::ALT_LEFT
, VKEY_MENU
},
586 {DomCode::ALT_RIGHT
, VKEY_ALTGR
},
587 #if defined(OS_POSIX)
588 {DomCode::CONTEXT_MENU
, VKEY_COMPOSE
},
590 {DomCode::CONTROL_LEFT
, VKEY_CONTROL
},
591 {DomCode::LANG1
, VKEY_HANGUL
},
592 {DomCode::LANG2
, VKEY_HANJA
},
593 {DomCode::LANG5
, VKEY_DBE_DBCSCHAR
},
594 {DomCode::NUMPAD_CLEAR
, VKEY_OEM_CLEAR
},
595 {DomCode::NUMPAD_DECIMAL
, VKEY_SEPARATOR
},
596 {DomCode::PROPS
, VKEY_CRSEL
},
597 {DomCode::SHIFT_LEFT
, VKEY_SHIFT
},
598 {DomCode::SUPER
, VKEY_OEM_8
},
600 // VKEYs with no directly corresponding DomCode, but a USB usage code:
601 // VKEY_ATTN // 0x07009A SysReq
602 // VKEY_SEPARATOR // 0x07009F Separator
603 // VKEY_EXSEL // 0x0700A4 ExSel
604 // VKEY_PRINT // 0x0C0208 AC Print
605 // VKEY_PLAY // 0x0C00B0 MediaPlay
606 // VKEY_OEM_103 // 0x0C00B4 MediaRewind
607 // VKEY_OEM_104 // 0x0C00B3 MediaFastForward
609 // VKEYs with no corresponding DomCode, but a Linux evdev usage code:
610 // VKEY_KBD_BRIGHTNESS_DOWN // evdev KEY_KBDILLUMDOWN
611 // VKEY_KBD_BRIGHTNESS_UP // evdev KEY_KBDILLUMUP
612 // VKEY_WLAN // evdev KEY_WLAN
614 // VKEYs with no corresponding DomCode and no obvious USB usage code:
630 #endif // UI_EVENTS_KEYCODES_DOM_US_LAYOUT_DATA_H_