Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file (temporarily) lives in two places: | |
| 6 // src/remoting/host/usb_keycode_map.h | |
| 7 // src/webkit/plugins/ppapi/usb_keycode_map.h | |
| 8 // Changes to this file must be made in both locations. | |
| 9 // TODO(wez): Move file into shared location (crbug.com/122174). | |
| 10 | |
| 11 // Data in this file was created by referencing: | 5 // Data in this file was created by referencing: |
| 12 // USB HID Usage Tables (v1.11) 27 June 2001 | 6 // USB HID Usage Tables (v1.11) 27 June 2001 |
| 13 // HIToolbox/Events.h (Mac) | 7 // HIToolbox/Events.h (Mac) |
| 14 | 8 |
| 15 typedef struct { | 9 typedef struct { |
| 16 // USB keycode: | 10 // USB keycode: |
| 17 // Upper 16-bits: USB Usage Page. | 11 // Upper 16-bits: USB Usage Page. |
| 18 // Lower 16-bits: USB Usage Id: Assigned ID within this usage page. | 12 // Lower 16-bits: USB Usage Id: Assigned ID within this usage page. |
| 19 uint32_t usb_keycode; | 13 uint32_t usb_keycode; |
| 20 | 14 |
| 21 // Contains one of the following: | 15 // Contains one of the following: |
| 22 // On Linux: XKB scancode | 16 // On Linux: XKB scancode |
| 23 // On Windows: Windows OEM scancode TODO(garykac) | 17 // On Windows: Windows OEM scancode TODO(garykac) |
|
Wez
2012/06/12 20:33:06
Are these two TODOs still valid? If so, what is st
garykac
2012/06/12 20:44:13
Done.
| |
| 24 // On Mac: Mac keycode TODO(garykac) | 18 // On Mac: Mac keycode TODO(garykac) |
| 25 uint16_t native_keycode; | 19 uint16_t native_keycode; |
| 26 } usb_keymap; | 20 } usb_keymap; |
| 27 | 21 |
| 28 const usb_keymap usb_keycode_map[] = { | 22 const usb_keymap usb_keycode_map[] = { |
| 29 | 23 |
| 30 // USB XKB Win Mac | 24 // USB XKB Win Mac |
| 31 USB_KEYMAP(0x000000, 0x0000, 0x0000, 0xffff), // Invalid | 25 USB_KEYMAP(0x000000, 0x0000, 0x0000, 0xffff), // Invalid |
| 32 | 26 |
| 33 // ========================================= | 27 // ========================================= |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 | 376 |
| 383 const uint16_t kInvalidKeycode = usb_keycode_map[0].native_keycode; | 377 const uint16_t kInvalidKeycode = usb_keycode_map[0].native_keycode; |
| 384 | 378 |
| 385 static uint16 UsbKeycodeToNativeKeycode(uint32_t usb_keycode) { | 379 static uint16 UsbKeycodeToNativeKeycode(uint32_t usb_keycode) { |
| 386 for (size_t i = 0; i < arraysize(usb_keycode_map); ++i) { | 380 for (size_t i = 0; i < arraysize(usb_keycode_map); ++i) { |
| 387 if (usb_keycode_map[i].usb_keycode == usb_keycode) | 381 if (usb_keycode_map[i].usb_keycode == usb_keycode) |
| 388 return usb_keycode_map[i].native_keycode; | 382 return usb_keycode_map[i].native_keycode; |
| 389 } | 383 } |
| 390 return kInvalidKeycode; | 384 return kInvalidKeycode; |
| 391 } | 385 } |
| OLD | NEW |