Durable Storage: Refactor browser test and test the basic "deny" flow.
[chromium-blink-merge.git] / ui / events / keycodes / keyboard_code_conversion_xkb.cc
blobb84988a1ed993d59308dff5d6a890010cb571c38
1 // Copyright 2014 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 #include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
7 #include "ui/events/keycodes/dom/dom_key.h"
8 #include "ui/events/keycodes/keyboard_code_conversion.h"
10 namespace ui {
12 DomKey NonPrintableXKeySymToDomKey(xkb_keysym_t keysym) {
13 switch (keysym) {
14 case XKB_KEY_BackSpace:
15 return DomKey::BACKSPACE;
16 case XKB_KEY_Tab:
17 case XKB_KEY_KP_Tab:
18 case XKB_KEY_ISO_Left_Tab:
19 return DomKey::TAB;
20 case XKB_KEY_Clear:
21 case XKB_KEY_KP_Begin:
22 case XKB_KEY_XF86Clear:
23 return DomKey::CLEAR;
24 case XKB_KEY_Return:
25 case XKB_KEY_KP_Enter:
26 return DomKey::ENTER;
27 case XKB_KEY_Linefeed:
28 return DomKey::ENTER;
29 case XKB_KEY_Pause:
30 return DomKey::PAUSE;
31 case XKB_KEY_Scroll_Lock:
32 return DomKey::SCROLL_LOCK;
33 case XKB_KEY_Escape:
34 return DomKey::ESCAPE;
35 case XKB_KEY_Multi_key:
36 return DomKey::COMPOSE;
37 case XKB_KEY_Kanji:
38 return DomKey::KANJI_MODE;
39 case XKB_KEY_Muhenkan:
40 return DomKey::NON_CONVERT;
41 case XKB_KEY_Henkan_Mode:
42 return DomKey::CONVERT;
43 case XKB_KEY_Romaji:
44 return DomKey::ROMAJI;
45 case XKB_KEY_Hiragana:
46 return DomKey::HIRAGANA;
47 case XKB_KEY_Katakana:
48 return DomKey::KATAKANA;
49 case XKB_KEY_Hiragana_Katakana:
50 return DomKey::HIRAGANA_KATAKANA;
51 case XKB_KEY_Zenkaku:
52 return DomKey::ZENKAKU;
53 case XKB_KEY_Hankaku:
54 return DomKey::HANKAKU;
55 case XKB_KEY_Zenkaku_Hankaku:
56 return DomKey::ZENKAKU_HANKAKU;
57 case XKB_KEY_Kana_Lock:
58 return DomKey::KANA_MODE;
59 case XKB_KEY_Eisu_Shift:
60 case XKB_KEY_Eisu_toggle:
61 return DomKey::EISU;
62 case XKB_KEY_Hangul:
63 return DomKey::HANGUL_MODE;
64 case XKB_KEY_Hangul_Hanja:
65 return DomKey::HANJA_MODE;
66 case XKB_KEY_Codeinput:
67 return DomKey::CODE_INPUT;
68 case XKB_KEY_SingleCandidate:
69 return DomKey::SINGLE_CANDIDATE;
70 case XKB_KEY_MultipleCandidate:
71 return DomKey::ALL_CANDIDATES;
72 case XKB_KEY_PreviousCandidate:
73 return DomKey::PREVIOUS_CANDIDATE;
74 case XKB_KEY_Home:
75 case XKB_KEY_KP_Home:
76 return DomKey::HOME;
77 case XKB_KEY_Left:
78 case XKB_KEY_KP_Left:
79 return DomKey::ARROW_LEFT;
80 case XKB_KEY_Up:
81 case XKB_KEY_KP_Up:
82 return DomKey::ARROW_UP;
83 case XKB_KEY_Right:
84 case XKB_KEY_KP_Right:
85 return DomKey::ARROW_RIGHT;
86 case XKB_KEY_Down:
87 case XKB_KEY_KP_Down:
88 return DomKey::ARROW_DOWN;
89 case XKB_KEY_Prior:
90 case XKB_KEY_KP_Prior:
91 return DomKey::PAGE_UP;
92 case XKB_KEY_Next:
93 case XKB_KEY_KP_Next:
94 case XKB_KEY_XF86ScrollDown:
95 return DomKey::PAGE_DOWN;
96 case XKB_KEY_End:
97 case XKB_KEY_KP_End:
98 case XKB_KEY_XF86ScrollUp:
99 return DomKey::END;
100 case XKB_KEY_Select:
101 return DomKey::SELECT;
102 case XKB_KEY_Print:
103 return DomKey::PRINT;
104 case XKB_KEY_Execute:
105 return DomKey::EXECUTE;
106 case XKB_KEY_Insert:
107 case XKB_KEY_KP_Insert:
108 return DomKey::INSERT;
109 case XKB_KEY_Undo:
110 return DomKey::UNDO;
111 case XKB_KEY_Redo:
112 return DomKey::REDO;
113 case XKB_KEY_Menu:
114 return DomKey::CONTEXT_MENU;
115 case XKB_KEY_Find:
116 return DomKey::FIND;
117 case XKB_KEY_Cancel:
118 return DomKey::CANCEL;
119 case XKB_KEY_Help:
120 return DomKey::HELP;
121 case XKB_KEY_Break:
122 case XKB_KEY_3270_Attn:
123 return DomKey::ATTN;
124 case XKB_KEY_Mode_switch:
125 return DomKey::MODE_CHANGE;
126 case XKB_KEY_Num_Lock:
127 return DomKey::NUM_LOCK;
128 case XKB_KEY_F1:
129 case XKB_KEY_KP_F1:
130 return DomKey::F1;
131 case XKB_KEY_F2:
132 case XKB_KEY_KP_F2:
133 return DomKey::F2;
134 case XKB_KEY_F3:
135 case XKB_KEY_KP_F3:
136 return DomKey::F3;
137 case XKB_KEY_F4:
138 case XKB_KEY_KP_F4:
139 return DomKey::F4;
140 case XKB_KEY_F5:
141 return DomKey::F5;
142 case XKB_KEY_F6:
143 return DomKey::F6;
144 case XKB_KEY_F7:
145 return DomKey::F7;
146 case XKB_KEY_F8:
147 return DomKey::F8;
148 case XKB_KEY_F9:
149 return DomKey::F9;
150 case XKB_KEY_F10:
151 return DomKey::F10;
152 case XKB_KEY_F11:
153 return DomKey::F11;
154 case XKB_KEY_F12:
155 return DomKey::F12;
156 case XKB_KEY_XF86Tools: // XKB 'inet' mapping of F13
157 case XKB_KEY_F13:
158 return DomKey::F13;
159 case XKB_KEY_F14:
160 case XKB_KEY_XF86Launch5: // XKB 'inet' mapping of F14
161 return DomKey::F14;
162 case XKB_KEY_F15:
163 case XKB_KEY_XF86Launch6: // XKB 'inet' mapping of F15
164 return DomKey::F15;
165 case XKB_KEY_F16:
166 case XKB_KEY_XF86Launch7: // XKB 'inet' mapping of F16
167 return DomKey::F16;
168 case XKB_KEY_F17:
169 case XKB_KEY_XF86Launch8: // XKB 'inet' mapping of F17
170 return DomKey::F17;
171 case XKB_KEY_F18:
172 case XKB_KEY_XF86Launch9: // XKB 'inet' mapping of F18
173 return DomKey::F18;
174 case XKB_KEY_F19:
175 return DomKey::F19;
176 case XKB_KEY_F20:
177 return DomKey::F20;
178 case XKB_KEY_F21:
179 return DomKey::F21;
180 case XKB_KEY_F22:
181 return DomKey::F22;
182 case XKB_KEY_F23:
183 return DomKey::F23;
184 case XKB_KEY_F24:
185 return DomKey::F24;
186 case XKB_KEY_Shift_L:
187 case XKB_KEY_Shift_R:
188 return DomKey::SHIFT;
189 case XKB_KEY_Control_L:
190 case XKB_KEY_Control_R:
191 return DomKey::CONTROL;
192 case XKB_KEY_Caps_Lock:
193 return DomKey::CAPS_LOCK;
194 case XKB_KEY_Meta_L:
195 case XKB_KEY_Meta_R:
196 return DomKey::META;
197 case XKB_KEY_Alt_L:
198 case XKB_KEY_Alt_R:
199 return DomKey::ALT;
200 case XKB_KEY_Super_L:
201 case XKB_KEY_Super_R:
202 return DomKey::OS;
203 case XKB_KEY_Hyper_L:
204 case XKB_KEY_Hyper_R:
205 return DomKey::HYPER;
206 case XKB_KEY_Delete:
207 return DomKey::DEL;
208 case XKB_KEY_SunProps:
209 return DomKey::PROPS;
210 case XKB_KEY_XF86Next_VMode:
211 return DomKey::VIDEO_MODE_NEXT;
212 case XKB_KEY_XF86MonBrightnessUp:
213 return DomKey::BRIGHTNESS_UP;
214 case XKB_KEY_XF86MonBrightnessDown:
215 return DomKey::BRIGHTNESS_DOWN;
216 case XKB_KEY_XF86Standby:
217 case XKB_KEY_XF86Sleep:
218 case XKB_KEY_XF86Suspend:
219 return DomKey::STANDBY;
220 case XKB_KEY_XF86AudioLowerVolume:
221 return DomKey::VOLUME_DOWN;
222 case XKB_KEY_XF86AudioMute:
223 return DomKey::VOLUME_MUTE;
224 case XKB_KEY_XF86AudioRaiseVolume:
225 return DomKey::VOLUME_UP;
226 case XKB_KEY_XF86AudioPlay:
227 return DomKey::MEDIA_PLAY;
228 case XKB_KEY_XF86AudioStop:
229 return DomKey::MEDIA_STOP;
230 case XKB_KEY_XF86AudioPrev:
231 return DomKey::MEDIA_TRACK_PREVIOUS;
232 case XKB_KEY_XF86AudioNext:
233 return DomKey::MEDIA_TRACK_NEXT;
234 case XKB_KEY_XF86HomePage:
235 return DomKey::BROWSER_HOME;
236 case XKB_KEY_XF86Mail:
237 return DomKey::LAUNCH_MAIL;
238 case XKB_KEY_XF86Search:
239 return DomKey::BROWSER_SEARCH;
240 case XKB_KEY_XF86AudioRecord:
241 return DomKey::MEDIA_RECORD;
242 case XKB_KEY_XF86Calculator:
243 return DomKey::LAUNCH_CALCULATOR;
244 case XKB_KEY_XF86Calendar:
245 return DomKey::LAUNCH_CALENDAR;
246 case XKB_KEY_XF86Back:
247 return DomKey::BROWSER_BACK;
248 case XKB_KEY_XF86Forward:
249 return DomKey::BROWSER_FORWARD;
250 case XKB_KEY_XF86Stop:
251 return DomKey::BROWSER_STOP;
252 case XKB_KEY_XF86Refresh:
253 case XKB_KEY_XF86Reload:
254 return DomKey::BROWSER_REFRESH;
255 case XKB_KEY_XF86PowerOff:
256 return DomKey::POWER_OFF;
257 case XKB_KEY_XF86WakeUp:
258 return DomKey::WAKE_UP;
259 case XKB_KEY_XF86Eject:
260 return DomKey::EJECT;
261 case XKB_KEY_XF86ScreenSaver:
262 return DomKey::LAUNCH_SCREEN_SAVER;
263 case XKB_KEY_XF86WWW:
264 return DomKey::LAUNCH_WEB_BROWSER;
265 case XKB_KEY_XF86Favorites:
266 return DomKey::BROWSER_FAVORITES;
267 case XKB_KEY_XF86AudioPause:
268 return DomKey::MEDIA_PAUSE;
269 case XKB_KEY_XF86AudioMedia:
270 case XKB_KEY_XF86Music:
271 return DomKey::LAUNCH_MUSIC_PLAYER;
272 case XKB_KEY_XF86MyComputer:
273 case XKB_KEY_XF86Explorer:
274 return DomKey::LAUNCH_MY_COMPUTER;
275 case XKB_KEY_XF86AudioRewind:
276 return DomKey::MEDIA_REWIND;
277 case XKB_KEY_XF86CD:
278 case XKB_KEY_XF86Video:
279 return DomKey::LAUNCH_MEDIA_PLAYER;
280 case XKB_KEY_XF86Close:
281 return DomKey::CLOSE;
282 case XKB_KEY_XF86Copy:
283 case XKB_KEY_SunCopy:
284 return DomKey::COPY;
285 case XKB_KEY_XF86Cut:
286 case XKB_KEY_SunCut:
287 return DomKey::CUT;
288 case XKB_KEY_XF86Display:
289 return DomKey::DISPLAY_SWAP;
290 case XKB_KEY_XF86Excel:
291 return DomKey::LAUNCH_SPREADSHEET;
292 case XKB_KEY_XF86LogOff:
293 return DomKey::LOG_OFF;
294 case XKB_KEY_XF86New:
295 return DomKey::NEW;
296 case XKB_KEY_XF86Open:
297 case XKB_KEY_SunOpen:
298 return DomKey::OPEN;
299 case XKB_KEY_XF86Paste:
300 case XKB_KEY_SunPaste:
301 return DomKey::PASTE;
302 case XKB_KEY_XF86Reply:
303 return DomKey::MAIL_REPLY;
304 case XKB_KEY_XF86Save:
305 return DomKey::SAVE;
306 case XKB_KEY_XF86Send:
307 return DomKey::MAIL_SEND;
308 case XKB_KEY_XF86Spell:
309 return DomKey::SPELL_CHECK;
310 case XKB_KEY_XF86SplitScreen:
311 return DomKey::SPLIT_SCREEN_TOGGLE;
312 case XKB_KEY_XF86Word:
313 case XKB_KEY_XF86OfficeHome:
314 return DomKey::LAUNCH_WORD_PROCESSOR;
315 case XKB_KEY_XF86ZoomIn:
316 return DomKey::ZOOM_IN;
317 case XKB_KEY_XF86ZoomOut:
318 return DomKey::ZOOM_OUT;
319 case XKB_KEY_XF86WebCam:
320 return DomKey::LAUNCH_WEB_CAM;
321 case XKB_KEY_XF86MailForward:
322 return DomKey::MAIL_FORWARD;
323 case XKB_KEY_XF86AudioForward:
324 return DomKey::MEDIA_FAST_FORWARD;
325 case XKB_KEY_XF86AudioRandomPlay:
326 return DomKey::RANDOM_TOGGLE;
327 case XKB_KEY_XF86Subtitle:
328 return DomKey::SUBTITLE;
329 case XKB_KEY_XF86Hibernate:
330 return DomKey::HIBERNATE;
331 case XKB_KEY_3270_EraseEOF:
332 return DomKey::ERASE_EOF;
333 case XKB_KEY_3270_Play:
334 return DomKey::PLAY;
335 case XKB_KEY_3270_ExSelect:
336 return DomKey::EX_SEL;
337 case XKB_KEY_3270_CursorSelect:
338 return DomKey::CR_SEL;
339 case XKB_KEY_3270_PrintScreen:
340 return DomKey::PRINT_SCREEN;
341 case XKB_KEY_ISO_Level3_Shift:
342 return DomKey::ALT_GRAPH;
343 case XKB_KEY_ISO_Level3_Latch:
344 return DomKey::ALT_GRAPH_LATCH;
345 case XKB_KEY_ISO_Level5_Shift:
346 return DomKey::SHIFT_LEVEL5;
347 case XKB_KEY_ISO_Next_Group:
348 return DomKey::GROUP_NEXT;
349 case XKB_KEY_ISO_Prev_Group:
350 return DomKey::GROUP_PREVIOUS;
351 case XKB_KEY_ISO_First_Group:
352 return DomKey::GROUP_FIRST;
353 case XKB_KEY_ISO_Last_Group:
354 return DomKey::GROUP_LAST;
355 case XKB_KEY_dead_grave:
356 case XKB_KEY_dead_acute:
357 case XKB_KEY_dead_circumflex:
358 case XKB_KEY_dead_tilde:
359 case XKB_KEY_dead_macron:
360 case XKB_KEY_dead_breve:
361 case XKB_KEY_dead_abovedot:
362 case XKB_KEY_dead_diaeresis:
363 case XKB_KEY_dead_abovering:
364 case XKB_KEY_dead_doubleacute:
365 case XKB_KEY_dead_caron:
366 case XKB_KEY_dead_cedilla:
367 case XKB_KEY_dead_ogonek:
368 case XKB_KEY_dead_iota:
369 case XKB_KEY_dead_belowdot:
370 case XKB_KEY_dead_hook:
371 case XKB_KEY_dead_horn:
372 case XKB_KEY_dead_stroke:
373 case XKB_KEY_dead_abovecomma:
374 case XKB_KEY_dead_abovereversedcomma:
375 case XKB_KEY_dead_doublegrave:
376 case XKB_KEY_dead_belowring:
377 case XKB_KEY_dead_belowmacron:
378 case XKB_KEY_dead_belowcircumflex:
379 case XKB_KEY_dead_belowtilde:
380 case XKB_KEY_dead_belowbreve:
381 case XKB_KEY_dead_belowdiaeresis:
382 case XKB_KEY_dead_invertedbreve:
383 case XKB_KEY_dead_belowcomma:
384 case XKB_KEY_dead_currency:
385 return DomKey::DEAD;
386 default:
387 return DomKey::NONE;
391 DomKey XKeySymToDomKey(xkb_keysym_t keysym, base::char16 character) {
392 DomKey dom_key = NonPrintableXKeySymToDomKey(keysym);
393 if (dom_key == DomKey::NONE)
394 dom_key = CharacterToDomKey(character);
395 return dom_key;
398 } // namespace ui