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

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

Issue 660173002: Type conversion fixes, ui/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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
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 namespace ui { 7 namespace ui {
8 8
9 namespace { 9 namespace {
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 return InvalidNativeKeycode(); 71 return InvalidNativeKeycode();
72 } 72 }
73 73
74 // USB keycodes 74 // USB keycodes
75 // Note that USB keycodes are not part of any web standard. 75 // Note that USB keycodes are not part of any web standard.
76 // Please don't use USB keycodes in new code. 76 // Please don't use USB keycodes in new code.
77 77
78 // static 78 // static
79 uint16_t KeycodeConverter::InvalidUsbKeycode() { 79 uint16_t KeycodeConverter::InvalidUsbKeycode() {
80 return usb_keycode_map[0].usb_keycode; 80 return static_cast<uint16_t>(usb_keycode_map[0].usb_keycode);
81 } 81 }
82 82
83 // static 83 // static
84 uint16_t KeycodeConverter::UsbKeycodeToNativeKeycode(uint32_t usb_keycode) { 84 uint16_t KeycodeConverter::UsbKeycodeToNativeKeycode(uint32_t usb_keycode) {
85 // Deal with some special-cases that don't fit the 1:1 mapping. 85 // Deal with some special-cases that don't fit the 1:1 mapping.
86 if (usb_keycode == 0x070032) // non-US hash. 86 if (usb_keycode == 0x070032) // non-US hash.
87 usb_keycode = 0x070031; // US backslash. 87 usb_keycode = 0x070031; // US backslash.
88 #if defined(OS_MACOSX) 88 #if defined(OS_MACOSX)
89 if (usb_keycode == 0x070046) // PrintScreen. 89 if (usb_keycode == 0x070046) // PrintScreen.
90 usb_keycode = 0x070068; // F13. 90 usb_keycode = 0x070068; // F13.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 for (size_t i = 0; i < kKeycodeMapEntries; ++i) { 125 for (size_t i = 0; i < kKeycodeMapEntries; ++i) {
126 if (usb_keycode_map[i].code && 126 if (usb_keycode_map[i].code &&
127 strcmp(usb_keycode_map[i].code, code) == 0) { 127 strcmp(usb_keycode_map[i].code, code) == 0) {
128 return usb_keycode_map[i].usb_keycode; 128 return usb_keycode_map[i].usb_keycode;
129 } 129 }
130 } 130 }
131 return InvalidUsbKeycode(); 131 return InvalidUsbKeycode();
132 } 132 }
133 133
134 } // namespace ui 134 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/velocity_tracker.cc ('k') | ui/events/keycodes/keyboard_code_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698