Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / ui / base / ime / chromeos / ime_keymap.cc
blob16b32f328ad8ee2d98f6df0da022135e5d7c2dbd
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/base/ime/chromeos/ime_keymap.h"
7 #define XK_MISCELLANY
8 #include <X11/keysymdef.h>
9 #include <X11/XF86keysym.h>
11 namespace ui {
13 std::string FromXKeycodeToKeyValue(int keyval) {
14 // TODO: Ensure all keys are supported.
15 switch (keyval) {
16 case XK_Escape:
17 return "Esc";
18 case XK_F1:
19 case XF86XK_Back:
20 return "HistoryBack";
21 case XK_F2:
22 case XF86XK_Forward:
23 return "HistoryForward";
24 case XK_F3:
25 case XF86XK_Reload:
26 return "BrowserRefresh";
27 case XK_F4:
28 case XF86XK_LaunchB:
29 return "ChromeOSFullscreen"; // TODO: Check this value
30 case XK_F5:
31 case XF86XK_LaunchA:
32 return "ChromeOSSwitchWindow"; // TODO: Check this value
33 case XK_F6:
34 case XF86XK_MonBrightnessDown:
35 return "BrightnessDown";
36 case XK_F7:
37 case XF86XK_MonBrightnessUp:
38 return "BrightnessUp";
39 case XK_F8:
40 case XF86XK_AudioMute:
41 return "AudioVolumeMute";
42 case XK_F9:
43 case XF86XK_AudioLowerVolume:
44 return "AudioVolumeDown";
45 case XK_F10:
46 case XF86XK_AudioRaiseVolume:
47 return "AudioVolumeUp";
48 case XK_BackSpace:
49 return "Backspace";
50 case XK_Delete:
51 case XK_KP_Delete:
52 return "Delete";
53 case XK_Tab:
54 return "Tab";
55 case XK_KP_Enter:
56 case XK_Return:
57 return "Enter";
58 case XK_Meta_L:
59 return "BrowserSearch";
60 case XK_Up:
61 case XK_KP_Up:
62 return "Up";
63 case XK_Down:
64 case XK_KP_Down:
65 return "Down";
66 case XK_Left:
67 case XK_KP_Left:
68 return "Left";
69 case XK_Right:
70 case XK_KP_Right:
71 return "Right";
72 case XK_Page_Up:
73 return "PageUp";
74 case XK_Page_Down:
75 return "PageDown";
76 case XK_Home:
77 return "Home";
78 case XK_End:
79 return "End";
80 case XK_Shift_L:
81 case XK_Shift_R:
82 return "Shift";
83 case XK_Alt_L:
84 case XK_Alt_R:
85 return "Alt";
86 case XK_Control_L:
87 case XK_Control_R:
88 return "Ctrl";
89 case XK_Caps_Lock:
90 return "CapsLock";
91 default: {
92 // TODO: Properly support unicode characters.
93 char value[2];
94 value[0] = keyval;
95 value[1] = '\0';
96 return value;
101 } // namespace ui