 Chromium Code Reviews
 Chromium Code Reviews Issue 2910873002:
  [System-Keyboard-Lock] Add KeycodeConverter::CodeStringToNativeKeycode() function  (Closed)
    
  
    Issue 2910873002:
  [System-Keyboard-Lock] Add KeycodeConverter::CodeStringToNativeKeycode() function  (Closed) 
  | OLD | NEW | 
|---|---|
| 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 #ifndef UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ | 5 #ifndef UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ | 
| 6 #define UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ | 6 #define UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ | 
| 7 | 7 | 
| 8 #include <stddef.h> | 8 #include <stddef.h> | 
| 9 #include <stdint.h> | 9 #include <stdint.h> | 
| 10 #include <string> | 10 #include <string> | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 // Convert a platform native keycode into an equivalent USB keycode. | 93 // Convert a platform native keycode into an equivalent USB keycode. | 
| 94 static uint32_t NativeKeycodeToUsbKeycode(int native_keycode); | 94 static uint32_t NativeKeycodeToUsbKeycode(int native_keycode); | 
| 95 | 95 | 
| 96 // Convert a USB keycode into a DomCode. | 96 // Convert a USB keycode into a DomCode. | 
| 97 static DomCode UsbKeycodeToDomCode(uint32_t usb_keycode); | 97 static DomCode UsbKeycodeToDomCode(uint32_t usb_keycode); | 
| 98 | 98 | 
| 99 // Convert a DomCode into a USB keycode. | 99 // Convert a DomCode into a USB keycode. | 
| 100 static uint32_t DomCodeToUsbKeycode(DomCode dom_code); | 100 static uint32_t DomCodeToUsbKeycode(DomCode dom_code); | 
| 101 | 101 | 
| 102 // Convert a DOM3 Event |code| string into a USB keycode value. | 102 // Convert a DOM3 Event |code| string into a USB keycode value. | 
| 103 static uint32_t CodeToUsbKeycode(const std::string& code); | 103 static uint32_t CodeStringToUsbKeycode(const std::string& code); | 
| 104 | |
| 105 // Convert a DOM3 Event |code| string into a native keycode. | |
| 
garykac
2017/06/02 01:19:38
Use "UI Event" instead of "DOM3 Event".
"Dom3 eve
 
Hzj_jie
2017/06/02 02:13:13
Done.
 | |
| 106 static int CodeStringToNativeKeycode(const std::string& code); | |
| 104 | 107 | 
| 105 // Static methods to support testing. | 108 // Static methods to support testing. | 
| 106 static size_t NumKeycodeMapEntriesForTest(); | 109 static size_t NumKeycodeMapEntriesForTest(); | 
| 107 static const KeycodeMapEntry* GetKeycodeMapForTest(); | 110 static const KeycodeMapEntry* GetKeycodeMapForTest(); | 
| 108 static const char* DomKeyStringForTest(size_t index); | 111 static const char* DomKeyStringForTest(size_t index); | 
| 109 | 112 | 
| 110 private: | 113 private: | 
| 111 DISALLOW_COPY_AND_ASSIGN(KeycodeConverter); | 114 DISALLOW_COPY_AND_ASSIGN(KeycodeConverter); | 
| 112 }; | 115 }; | 
| 113 | 116 | 
| 114 } // namespace ui | 117 } // namespace ui | 
| 115 | 118 | 
| 116 #endif // UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ | 119 #endif // UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ | 
| OLD | NEW |