Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1163)

Side by Side Diff: content/shell/renderer/test_runner/key_code_mapping.cc

Issue 234533002: Remove a bunch of TOOLKIT_GTK in content/ and gpu/, as well as NPAPI plugins on linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, skip changing browser_main_loop.cc because of presubmit issues, will follow up Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "content/shell/renderer/test_runner/key_code_mapping.h"
6
7 #include "build/build_config.h"
8
9 namespace content {
10
11 int NativeKeyCodeForWindowsKeyCode(int keysym) {
12 #if defined(OS_LINUX) && defined(TOOLKIT_GTK)
13 // See /usr/share/X11/xkb/keycodes/*
14 static const int ascii_to_key_code[] = {
15 0,
16 0,
17 0,
18 0,
19 0,
20 0,
21 0,
22 0,
23 22,
24 23,
25 0,
26 0,
27 0,
28 36,
29 0,
30 0,
31 50,
32 37,
33 64,
34 127,
35 66,
36 0,
37 0,
38 0,
39 0,
40 131,
41 0,
42 9,
43 100,
44 102,
45 0,
46 0,
47 65, // ' '
48 112, // '!'
49 117, // '"'
50 115, // '#'
51 110, // '$'
52 113, // '%'
53 111, // '&'
54 114, // '''
55 116, // '('
56 0, // ')'
57 107, // '*'
58 0, // '+'
59 0, // ','
60 118, // '-'
61 119, // '.'
62 146, // '/'
63 19, // '0'
64 10, // '1'
65 11, // '2'
66 12, // '3'
67 13, // '4'
68 14, // '5'
69 15, // '6'
70 16, // '7'
71 17, // '8'
72 18, // '9'
73 0, // ':'
74 0, // ';'
75 0, // '<'
76 0, // '='
77 0, // '>'
78 0, // '?'
79 0, // '@'
80 38, // 'A'
81 56, // 'B'
82 54, // 'C'
83 40, // 'D'
84 26, // 'E'
85 41, // 'F'
86 42, // 'G'
87 43, // 'H'
88 31, // 'I'
89 44, // 'J'
90 45, // 'K'
91 46, // 'L'
92 58, // 'M'
93 57, // 'N'
94 32, // 'O'
95 33, // 'P'
96 24, // 'Q'
97 27, // 'R'
98 39, // 'S'
99 28, // 'T'
100 30, // 'U'
101 55, // 'V'
102 25, // 'W'
103 53, // 'X'
104 29, // 'Y'
105 52, // 'Z'
106 133, // '['
107 134, // '\'
108 135, // ']'
109 0, // '^'
110 0, // '_'
111 90, // '`'
112 38, // 'a'
113 56, // 'b'
114 54, // 'c'
115 40, // 'd'
116 26, // 'e'
117 41, // 'f'
118 42, // 'g'
119 43, // 'h'
120 31, // 'i'
121 44, // 'j'
122 45, // 'k'
123 46, // 'l'
124 58, // 'm'
125 57, // 'n'
126 32, // 'o'
127 33, // 'p'
128 24, // 'q'
129 27, // 'r'
130 39, // 's'
131 28, // 't'
132 30, // 'u'
133 55, // 'v'
134 25, // 'w'
135 53, // 'x'
136 29, // 'y'
137 52, // 'z'
138 96, // '{'
139 0, // '|'
140 0, // '}'
141 0, // '~'
142 0, // DEL
143 };
144
145 if (keysym <= 127)
146 return ascii_to_key_code[keysym];
147
148 switch (keysym) {
149 case VKEY_PRIOR:
150 return 112;
151 case VKEY_NEXT:
152 return 117;
153 case VKEY_END:
154 return 115;
155 case VKEY_HOME:
156 return 110;
157 case VKEY_LEFT:
158 return 113;
159 case VKEY_UP:
160 return 111;
161 case VKEY_RIGHT:
162 return 114;
163 case VKEY_DOWN:
164 return 116;
165 case VKEY_SNAPSHOT:
166 return 107;
167 case VKEY_INSERT:
168 return 118;
169 case VKEY_DELETE:
170 return 119;
171 case VKEY_APPS:
172 return 135;
173 case VKEY_F1:
174 case VKEY_F1 + 1:
175 case VKEY_F1 + 2:
176 case VKEY_F1 + 3:
177 case VKEY_F1 + 4:
178 case VKEY_F1 + 5:
179 case VKEY_F1 + 6:
180 case VKEY_F1 + 7:
181 case VKEY_F1 + 8:
182 case VKEY_F1 + 9:
183 case VKEY_F1 + 10:
184 case VKEY_F1 + 11:
185 case VKEY_F1 + 12:
186 case VKEY_F1 + 13:
187 case VKEY_F1 + 14:
188 case VKEY_F1 + 15:
189 case VKEY_F1 + 16:
190 case VKEY_F1 + 17:
191 case VKEY_F1 + 18:
192 case VKEY_F1 + 19:
193 case VKEY_F1 + 20:
194 case VKEY_F1 + 21:
195 case VKEY_F1 + 22:
196 case VKEY_F1 + 23:
197 return 67 + (keysym - VKEY_F1);
198 case VKEY_LSHIFT:
199 return 50;
200 case VKEY_RSHIFT:
201 return 62;
202 case VKEY_LCONTROL:
203 return 37;
204 case VKEY_RCONTROL:
205 return 105;
206 case VKEY_LMENU:
207 return 64;
208 case VKEY_RMENU:
209 return 108;
210 case VKEY_NUMLOCK:
211 return 77;
212
213 default:
214 return 0;
215 }
216 #else
217 return keysym - keysym;
218 #endif
219 }
220
221 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/key_code_mapping.h ('k') | content/test/plugin/plugin_javascript_open_popup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698