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>
11 KeyboardCode
KeyboardCodeFromAndroidKeyCode(int keycode
) {
12 // Does not provide all key codes, and does not handle all keys.
20 case AKEYCODE_DPAD_CENTER
:
23 case AKEYCODE_SHIFT_LEFT
:
25 case AKEYCODE_SHIFT_RIGHT
:
28 return VKEY_BROWSER_BACK
;
29 case AKEYCODE_FORWARD
:
30 return VKEY_BROWSER_FORWARD
;
33 case AKEYCODE_MOVE_HOME
:
35 case AKEYCODE_DPAD_LEFT
:
37 case AKEYCODE_DPAD_UP
:
39 case AKEYCODE_DPAD_RIGHT
:
41 case AKEYCODE_DPAD_DOWN
:
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
;
128 case AKEYCODE_SEMICOLON
:
131 return VKEY_OEM_COMMA
;
133 return VKEY_OEM_MINUS
;
134 case AKEYCODE_EQUALS
:
135 return VKEY_OEM_PLUS
;
136 case AKEYCODE_PERIOD
:
137 return VKEY_OEM_PERIOD
;
140 case AKEYCODE_LEFT_BRACKET
:
142 case AKEYCODE_BACKSLASH
:
144 case AKEYCODE_RIGHT_BRACKET
:
147 case AKEYCODE_VOLUME_MUTE
:
148 return VKEY_VOLUME_MUTE
;
149 case AKEYCODE_ESCAPE
:
151 case AKEYCODE_MEDIA_PLAY
:
152 case AKEYCODE_MEDIA_PLAY_PAUSE
:
153 return VKEY_MEDIA_PLAY_PAUSE
;
154 case AKEYCODE_MOVE_END
:
156 case AKEYCODE_ALT_LEFT
:
158 case AKEYCODE_ALT_RIGHT
:
162 case AKEYCODE_APOSTROPHE
:
164 case AKEYCODE_MEDIA_REWIND
:
166 case AKEYCODE_MEDIA_FAST_FORWARD
:
168 case AKEYCODE_PAGE_UP
:
170 case AKEYCODE_PAGE_DOWN
:
172 case AKEYCODE_FORWARD_DEL
:
174 case AKEYCODE_CTRL_LEFT
:
175 return VKEY_LCONTROL
;
176 case AKEYCODE_CTRL_RIGHT
:
177 return VKEY_RCONTROL
;
178 case AKEYCODE_CAPS_LOCK
:
180 case AKEYCODE_SCROLL_LOCK
:
182 case AKEYCODE_META_LEFT
:
184 case AKEYCODE_META_RIGHT
:
188 case AKEYCODE_INSERT
:
214 case AKEYCODE_NUM_LOCK
:
216 case AKEYCODE_NUMPAD_0
:
218 case AKEYCODE_NUMPAD_1
:
220 case AKEYCODE_NUMPAD_2
:
222 case AKEYCODE_NUMPAD_3
:
224 case AKEYCODE_NUMPAD_4
:
226 case AKEYCODE_NUMPAD_5
:
228 case AKEYCODE_NUMPAD_6
:
230 case AKEYCODE_NUMPAD_7
:
232 case AKEYCODE_NUMPAD_8
:
234 case AKEYCODE_NUMPAD_9
:
236 case AKEYCODE_NUMPAD_DIVIDE
:
238 case AKEYCODE_NUMPAD_MULTIPLY
:
239 return VKEY_MULTIPLY
;
240 case AKEYCODE_NUMPAD_SUBTRACT
:
241 return VKEY_SUBTRACT
;
242 case AKEYCODE_NUMPAD_ADD
:
244 case AKEYCODE_NUMPAD_DOT
:
246 case AKEYCODE_CHANNEL_UP
:
248 case AKEYCODE_CHANNEL_DOWN
: