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

Side by Side Diff: ui/events/keycodes/dom4/keycode_converter.cc

Issue 756643006: Remote assistance on Chrome OS Part IX - Input injection on Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Ozone_input_injection
Patch Set: Address feedback (wez) Created 6 years 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
« no previous file with comments | « ui/events/keycodes/dom4/keycode_converter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/keycodes/dom4/keycode_converter.h" 5 #include "ui/events/keycodes/dom4/keycode_converter.h"
6 6
7 #include "ui/events/keycodes/dom3/dom_code.h" 7 #include "ui/events/keycodes/dom3/dom_code.h"
8 #include "ui/events/keycodes/dom3/dom_key.h" 8 #include "ui/events/keycodes/dom3/dom_key.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (usb_keycode_map[i].usb_keycode == usb_keycode) { 197 if (usb_keycode_map[i].usb_keycode == usb_keycode) {
198 if (usb_keycode_map[i].code) 198 if (usb_keycode_map[i].code)
199 return usb_keycode_map[i].code; 199 return usb_keycode_map[i].code;
200 break; 200 break;
201 } 201 }
202 } 202 }
203 return ""; 203 return "";
204 } 204 }
205 205
206 // static 206 // static
207 DomCode KeycodeConverter::UsbKeycodeToDomCode(uint32_t usb_keycode) {
208 for (size_t i = 0; i < kKeycodeMapEntries; ++i) {
209 if (usb_keycode_map[i].usb_keycode == usb_keycode)
210 return static_cast<DomCode>(usb_keycode);
211 }
212 return DomCode::NONE;
213 }
214
215 // static
207 uint32_t KeycodeConverter::CodeToUsbKeycode(const char* code) { 216 uint32_t KeycodeConverter::CodeToUsbKeycode(const char* code) {
208 if (!code || !*code) 217 if (!code || !*code)
209 return InvalidUsbKeycode(); 218 return InvalidUsbKeycode();
210 219
211 for (size_t i = 0; i < kKeycodeMapEntries; ++i) { 220 for (size_t i = 0; i < kKeycodeMapEntries; ++i) {
212 if (usb_keycode_map[i].code && 221 if (usb_keycode_map[i].code &&
213 strcmp(usb_keycode_map[i].code, code) == 0) { 222 strcmp(usb_keycode_map[i].code, code) == 0) {
214 return usb_keycode_map[i].usb_keycode; 223 return usb_keycode_map[i].usb_keycode;
215 } 224 }
216 } 225 }
217 return InvalidUsbKeycode(); 226 return InvalidUsbKeycode();
218 } 227 }
219 228
220 } // namespace ui 229 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/keycodes/dom4/keycode_converter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698