Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / events / keycodes / keyboard_code_conversion_android.cc
blob220e1b9b6ac08c5c47426c1d6488f2645afc87a2
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
3 // found in the LICENSE file.
5 #include "ui/events/keycodes/keyboard_code_conversion_android.h"
7 #include <android/keycodes.h>
9 namespace ui {
11 KeyboardCode KeyboardCodeFromAndroidKeyCode(int keycode) {
12 // Does not provide all key codes, and does not handle all keys.
13 switch (keycode) {
14 case AKEYCODE_DEL:
15 return VKEY_BACK;
16 case AKEYCODE_TAB:
17 return VKEY_TAB;
18 case AKEYCODE_CLEAR:
19 return VKEY_CLEAR;
20 case AKEYCODE_DPAD_CENTER:
21 case AKEYCODE_ENTER:
22 return VKEY_RETURN;
23 case AKEYCODE_SHIFT_LEFT:
24 return VKEY_LSHIFT;
25 case AKEYCODE_SHIFT_RIGHT:
26 return VKEY_RSHIFT;
27 case AKEYCODE_BACK:
28 return VKEY_BROWSER_BACK;
29 case AKEYCODE_FORWARD:
30 return VKEY_BROWSER_FORWARD;
31 case AKEYCODE_SPACE:
32 return VKEY_SPACE;
33 case AKEYCODE_MOVE_HOME:
34 return VKEY_HOME;
35 case AKEYCODE_DPAD_LEFT:
36 return VKEY_LEFT;
37 case AKEYCODE_DPAD_UP:
38 return VKEY_UP;
39 case AKEYCODE_DPAD_RIGHT:
40 return VKEY_RIGHT;
41 case AKEYCODE_DPAD_DOWN:
42 return VKEY_DOWN;
43 case AKEYCODE_0:
44 return VKEY_0;
45 case AKEYCODE_1:
46 return VKEY_1;
47 case AKEYCODE_2:
48 return VKEY_2;
49 case AKEYCODE_3:
50 return VKEY_3;
51 case AKEYCODE_4:
52 return VKEY_4;
53 case AKEYCODE_5:
54 return VKEY_5;
55 case AKEYCODE_6:
56 return VKEY_6;
57 case AKEYCODE_7:
58 return VKEY_7;
59 case AKEYCODE_8:
60 return VKEY_8;
61 case AKEYCODE_9:
62 return VKEY_9;
63 case AKEYCODE_A:
64 return VKEY_A;
65 case AKEYCODE_B:
66 return VKEY_B;
67 case AKEYCODE_C:
68 return VKEY_C;
69 case AKEYCODE_D:
70 return VKEY_D;
71 case AKEYCODE_E:
72 return VKEY_E;
73 case AKEYCODE_F:
74 return VKEY_F;
75 case AKEYCODE_G:
76 return VKEY_G;
77 case AKEYCODE_H:
78 return VKEY_H;
79 case AKEYCODE_I:
80 return VKEY_I;
81 case AKEYCODE_J:
82 return VKEY_J;
83 case AKEYCODE_K:
84 return VKEY_K;
85 case AKEYCODE_L:
86 return VKEY_L;
87 case AKEYCODE_M:
88 return VKEY_M;
89 case AKEYCODE_N:
90 return VKEY_N;
91 case AKEYCODE_O:
92 return VKEY_O;
93 case AKEYCODE_P:
94 return VKEY_P;
95 case AKEYCODE_Q:
96 return VKEY_Q;
97 case AKEYCODE_R:
98 return VKEY_R;
99 case AKEYCODE_S:
100 return VKEY_S;
101 case AKEYCODE_T:
102 return VKEY_T;
103 case AKEYCODE_U:
104 return VKEY_U;
105 case AKEYCODE_V:
106 return VKEY_V;
107 case AKEYCODE_W:
108 return VKEY_W;
109 case AKEYCODE_X:
110 return VKEY_X;
111 case AKEYCODE_Y:
112 return VKEY_Y;
113 case AKEYCODE_Z:
114 return VKEY_Z;
115 case AKEYCODE_VOLUME_DOWN:
116 return VKEY_VOLUME_DOWN;
117 case AKEYCODE_VOLUME_UP:
118 return VKEY_VOLUME_UP;
119 case AKEYCODE_MEDIA_NEXT:
120 return VKEY_MEDIA_NEXT_TRACK;
121 case AKEYCODE_MEDIA_PREVIOUS:
122 return VKEY_MEDIA_PREV_TRACK;
123 case AKEYCODE_MEDIA_STOP:
124 return VKEY_MEDIA_STOP;
125 case AKEYCODE_MEDIA_PAUSE:
126 return VKEY_MEDIA_PLAY_PAUSE;
127 // Colon key.
128 case AKEYCODE_SEMICOLON:
129 return VKEY_OEM_1;
130 case AKEYCODE_COMMA:
131 return VKEY_OEM_COMMA;
132 case AKEYCODE_MINUS:
133 return VKEY_OEM_MINUS;
134 case AKEYCODE_EQUALS:
135 return VKEY_OEM_PLUS;
136 case AKEYCODE_PERIOD:
137 return VKEY_OEM_PERIOD;
138 case AKEYCODE_SLASH:
139 return VKEY_OEM_2;
140 case AKEYCODE_LEFT_BRACKET:
141 return VKEY_OEM_4;
142 case AKEYCODE_BACKSLASH:
143 return VKEY_OEM_5;
144 case AKEYCODE_RIGHT_BRACKET:
145 return VKEY_OEM_6;
146 case AKEYCODE_MUTE:
147 case AKEYCODE_VOLUME_MUTE:
148 return VKEY_VOLUME_MUTE;
149 case AKEYCODE_ESCAPE:
150 return VKEY_ESCAPE;
151 case AKEYCODE_MEDIA_PLAY:
152 case AKEYCODE_MEDIA_PLAY_PAUSE:
153 return VKEY_MEDIA_PLAY_PAUSE;
154 case AKEYCODE_MOVE_END:
155 return VKEY_END;
156 case AKEYCODE_ALT_LEFT:
157 return VKEY_LMENU;
158 case AKEYCODE_ALT_RIGHT:
159 return VKEY_RMENU;
160 case AKEYCODE_GRAVE:
161 return VKEY_OEM_3;
162 case AKEYCODE_APOSTROPHE:
163 return VKEY_OEM_3;
164 case AKEYCODE_MEDIA_REWIND:
165 return VKEY_OEM_103;
166 case AKEYCODE_MEDIA_FAST_FORWARD:
167 return VKEY_OEM_104;
168 case AKEYCODE_PAGE_UP:
169 return VKEY_PRIOR;
170 case AKEYCODE_PAGE_DOWN:
171 return VKEY_NEXT;
172 case AKEYCODE_FORWARD_DEL:
173 return VKEY_DELETE;
174 case AKEYCODE_CTRL_LEFT:
175 return VKEY_LCONTROL;
176 case AKEYCODE_CTRL_RIGHT:
177 return VKEY_RCONTROL;
178 case AKEYCODE_CAPS_LOCK:
179 return VKEY_CAPITAL;
180 case AKEYCODE_SCROLL_LOCK:
181 return VKEY_SCROLL;
182 case AKEYCODE_META_LEFT:
183 return VKEY_LWIN;
184 case AKEYCODE_META_RIGHT:
185 return VKEY_RWIN;
186 case AKEYCODE_BREAK:
187 return VKEY_PAUSE;
188 case AKEYCODE_INSERT:
189 return VKEY_INSERT;
190 case AKEYCODE_F1:
191 return VKEY_F1;
192 case AKEYCODE_F2:
193 return VKEY_F2;
194 case AKEYCODE_F3:
195 return VKEY_F3;
196 case AKEYCODE_F4:
197 return VKEY_F4;
198 case AKEYCODE_F5:
199 return VKEY_F5;
200 case AKEYCODE_F6:
201 return VKEY_F6;
202 case AKEYCODE_F7:
203 return VKEY_F7;
204 case AKEYCODE_F8:
205 return VKEY_F8;
206 case AKEYCODE_F9:
207 return VKEY_F9;
208 case AKEYCODE_F10:
209 return VKEY_F10;
210 case AKEYCODE_F11:
211 return VKEY_F11;
212 case AKEYCODE_F12:
213 return VKEY_F12;
214 case AKEYCODE_NUM_LOCK:
215 return VKEY_NUMLOCK;
216 case AKEYCODE_NUMPAD_0:
217 return VKEY_NUMPAD0;
218 case AKEYCODE_NUMPAD_1:
219 return VKEY_NUMPAD1;
220 case AKEYCODE_NUMPAD_2:
221 return VKEY_NUMPAD2;
222 case AKEYCODE_NUMPAD_3:
223 return VKEY_NUMPAD3;
224 case AKEYCODE_NUMPAD_4:
225 return VKEY_NUMPAD4;
226 case AKEYCODE_NUMPAD_5:
227 return VKEY_NUMPAD5;
228 case AKEYCODE_NUMPAD_6:
229 return VKEY_NUMPAD6;
230 case AKEYCODE_NUMPAD_7:
231 return VKEY_NUMPAD7;
232 case AKEYCODE_NUMPAD_8:
233 return VKEY_NUMPAD8;
234 case AKEYCODE_NUMPAD_9:
235 return VKEY_NUMPAD9;
236 case AKEYCODE_NUMPAD_DIVIDE:
237 return VKEY_DIVIDE;
238 case AKEYCODE_NUMPAD_MULTIPLY:
239 return VKEY_MULTIPLY;
240 case AKEYCODE_NUMPAD_SUBTRACT:
241 return VKEY_SUBTRACT;
242 case AKEYCODE_NUMPAD_ADD:
243 return VKEY_ADD;
244 case AKEYCODE_NUMPAD_DOT:
245 return VKEY_DECIMAL;
246 case AKEYCODE_CHANNEL_UP:
247 return VKEY_PRIOR;
248 case AKEYCODE_CHANNEL_DOWN:
249 return VKEY_NEXT;
250 default:
251 return VKEY_UNKNOWN;
255 } // namespace ui