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

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

Issue 1124963003: Remove ui::KeycodeConverter::CodeToNativeKeycode(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@x444048-3a-codes
Patch Set: rebase 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 | « ui/events/event_unittest.cc ('k') | ui/events/keycodes/dom/keycode_converter.cc » ('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 #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 <stdint.h> 8 #include <stdint.h>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
(...skipping 27 matching lines...) Expand all
38 } KeycodeMapEntry; 38 } KeycodeMapEntry;
39 39
40 // A class to convert between the current platform's native keycode (scancode) 40 // A class to convert between the current platform's native keycode (scancode)
41 // and platform-neutral |code| values (as defined in the W3C UI Events 41 // and platform-neutral |code| values (as defined in the W3C UI Events
42 // spec (http://www.w3.org/TR/uievents/). 42 // spec (http://www.w3.org/TR/uievents/).
43 class KeycodeConverter { 43 class KeycodeConverter {
44 public: 44 public:
45 // Return the value that identifies an invalid native keycode. 45 // Return the value that identifies an invalid native keycode.
46 static int InvalidNativeKeycode(); 46 static int InvalidNativeKeycode();
47 47
48 // Convert a native (Mac/Win/Linux) keycode into the |code| string.
49 // The returned pointer references a static global string.
50 static const char* NativeKeycodeToCode(int native_keycode);
51
52 // Convert a native (Mac/Win/Linux) keycode into a DomCode. 48 // Convert a native (Mac/Win/Linux) keycode into a DomCode.
53 static DomCode NativeKeycodeToDomCode(int native_keycode); 49 static DomCode NativeKeycodeToDomCode(int native_keycode);
54 50
55 // Convert a UI Events |code| string value into a native keycode.
56 static int CodeToNativeKeycode(const char* code);
57
58 // Convert a DomCode into a native keycode. 51 // Convert a DomCode into a native keycode.
59 static int DomCodeToNativeKeycode(DomCode code); 52 static int DomCodeToNativeKeycode(DomCode code);
60 53
61 // Convert a UI Events |code| string value into a DomCode. 54 // Convert a UI Events |code| string value into a DomCode.
62 static DomCode CodeStringToDomCode(const char* code); 55 static DomCode CodeStringToDomCode(const char* code);
63 56
64 // Convert a DomCode into a UI Events |code| string value. 57 // Convert a DomCode into a UI Events |code| string value.
65 static const char* DomCodeToCodeString(DomCode dom_code); 58 static const char* DomCodeToCodeString(DomCode dom_code);
66 59
67 // Return the DomKeyLocation of a DomCode. The DomKeyLocation distinguishes 60 // Return the DomKeyLocation of a DomCode. The DomKeyLocation distinguishes
(...skipping 13 matching lines...) Expand all
81 74
82 // Return the value that identifies an invalid USB keycode. 75 // Return the value that identifies an invalid USB keycode.
83 static uint32_t InvalidUsbKeycode(); 76 static uint32_t InvalidUsbKeycode();
84 77
85 // Convert a USB keycode into an equivalent platform native keycode. 78 // Convert a USB keycode into an equivalent platform native keycode.
86 static int UsbKeycodeToNativeKeycode(uint32_t usb_keycode); 79 static int UsbKeycodeToNativeKeycode(uint32_t usb_keycode);
87 80
88 // Convert a platform native keycode into an equivalent USB keycode. 81 // Convert a platform native keycode into an equivalent USB keycode.
89 static uint32_t NativeKeycodeToUsbKeycode(int native_keycode); 82 static uint32_t NativeKeycodeToUsbKeycode(int native_keycode);
90 83
91 // Convert a USB keycode into the string with the DOM3 |code| value.
92 // The returned pointer references a static global string.
93 static const char* UsbKeycodeToCode(uint32_t usb_keycode);
94
95 // Convert a USB keycode into a DomCode. 84 // Convert a USB keycode into a DomCode.
96 static DomCode UsbKeycodeToDomCode(uint32_t usb_keycode); 85 static DomCode UsbKeycodeToDomCode(uint32_t usb_keycode);
97 86
87 // Convert a DomCode into a USB keycode.
88 static uint32_t DomCodeToUsbKeycode(DomCode dom_code);
89
98 // Convert a DOM3 Event |code| string into a USB keycode value. 90 // Convert a DOM3 Event |code| string into a USB keycode value.
99 static uint32_t CodeToUsbKeycode(const char* code); 91 static uint32_t CodeToUsbKeycode(const char* code);
100 92
101 // Static methods to support testing. 93 // Static methods to support testing.
102 static size_t NumKeycodeMapEntriesForTest(); 94 static size_t NumKeycodeMapEntriesForTest();
103 static const KeycodeMapEntry* GetKeycodeMapForTest(); 95 static const KeycodeMapEntry* GetKeycodeMapForTest();
104 static const char* DomKeyStringForTest(size_t index); 96 static const char* DomKeyStringForTest(size_t index);
105 97
106 private: 98 private:
107 DISALLOW_COPY_AND_ASSIGN(KeycodeConverter); 99 DISALLOW_COPY_AND_ASSIGN(KeycodeConverter);
108 }; 100 };
109 101
110 } // namespace ui 102 } // namespace ui
111 103
112 #endif // UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_ 104 #endif // UI_EVENTS_KEYCODES_DOM4_KEYCODE_CONVERTER_H_
OLDNEW
« no previous file with comments | « ui/events/event_unittest.cc ('k') | ui/events/keycodes/dom/keycode_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698