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

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

Issue 1108893002: Revise DOM Level 3 US Layout maps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase for keycodes/dom/ rename Created 5 years, 7 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
« no previous file with comments | « no previous file | ui/events/keycodes/dom/keycode_converter_data.inc » ('j') | 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/dom/keycode_converter.h" 5 #include "ui/events/keycodes/dom/keycode_converter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/events/keycodes/dom/dom_code.h" 8 #include "ui/events/keycodes/dom/dom_code.h"
9 #include "ui/events/keycodes/dom/dom_key.h" 9 #include "ui/events/keycodes/dom/dom_key.h"
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (usb_keycode_map[i].code && 101 if (usb_keycode_map[i].code &&
102 strcmp(usb_keycode_map[i].code, code) == 0) { 102 strcmp(usb_keycode_map[i].code, code) == 0) {
103 return usb_keycode_map[i].native_keycode; 103 return usb_keycode_map[i].native_keycode;
104 } 104 }
105 } 105 }
106 return InvalidNativeKeycode(); 106 return InvalidNativeKeycode();
107 } 107 }
108 108
109 // static 109 // static
110 int KeycodeConverter::DomCodeToNativeKeycode(DomCode code) { 110 int KeycodeConverter::DomCodeToNativeKeycode(DomCode code) {
111 if (code == DomCode::NONE) 111 return UsbKeycodeToNativeKeycode(static_cast<uint32_t>(code));
112 return InvalidNativeKeycode();
113 for (size_t i = 0; i < kKeycodeMapEntries; ++i) {
114 if (usb_keycode_map[i].usb_keycode == static_cast<uint32_t>(code))
115 return usb_keycode_map[i].native_keycode;
116 }
117 return InvalidNativeKeycode();
118 } 112 }
119 113
120 // static 114 // static
121 DomCode KeycodeConverter::CodeStringToDomCode(const char* code) { 115 DomCode KeycodeConverter::CodeStringToDomCode(const char* code) {
122 if (!code || !*code) { 116 if (!code || !*code) {
123 LOG(WARNING) << "empty code string"; 117 LOG(WARNING) << "empty code string";
124 return DomCode::NONE; 118 return DomCode::NONE;
125 } 119 }
126 for (size_t i = 0; i < kKeycodeMapEntries; ++i) { 120 for (size_t i = 0; i < kKeycodeMapEntries; ++i) {
127 if (usb_keycode_map[i].code && 121 if (usb_keycode_map[i].code &&
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 for (size_t i = 0; i < kKeycodeMapEntries; ++i) { 267 for (size_t i = 0; i < kKeycodeMapEntries; ++i) {
274 if (usb_keycode_map[i].code && 268 if (usb_keycode_map[i].code &&
275 strcmp(usb_keycode_map[i].code, code) == 0) { 269 strcmp(usb_keycode_map[i].code, code) == 0) {
276 return usb_keycode_map[i].usb_keycode; 270 return usb_keycode_map[i].usb_keycode;
277 } 271 }
278 } 272 }
279 return InvalidUsbKeycode(); 273 return InvalidUsbKeycode();
280 } 274 }
281 275
282 } // namespace ui 276 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/keycodes/dom/keycode_converter_data.inc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698