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 #ifndef UI_EVENTS_EVENT_UTILS_H_ | 5 #ifndef UI_EVENTS_EVENT_UTILS_H_ |
6 #define UI_EVENTS_EVENT_UTILS_H_ | 6 #define UI_EVENTS_EVENT_UTILS_H_ |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "base/event_types.h" | 9 #include "base/event_types.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/strings/string16.h" |
10 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
11 #include "ui/events/keycodes/keyboard_codes.h" | 13 #include "ui/events/keycodes/keyboard_codes.h" |
12 #include "ui/gfx/display.h" | 14 #include "ui/gfx/display.h" |
13 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
14 #include "ui/events/events_export.h" | 16 #include "ui/events/events_export.h" |
15 | 17 |
16 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
17 #include <windows.h> | 19 #include <windows.h> |
18 #endif | 20 #endif |
19 | 21 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Returns the DOM KeyboardEvent code (physical location in the | 82 // Returns the DOM KeyboardEvent code (physical location in the |
81 // keyboard) from a native event. The ownership of the return value | 83 // keyboard) from a native event. The ownership of the return value |
82 // is NOT trasferred to the caller. | 84 // is NOT trasferred to the caller. |
83 EVENTS_EXPORT const char* CodeFromNative( | 85 EVENTS_EXPORT const char* CodeFromNative( |
84 const base::NativeEvent& native_event); | 86 const base::NativeEvent& native_event); |
85 | 87 |
86 // Returns the platform related key code. For X11, it is xksym value. | 88 // Returns the platform related key code. For X11, it is xksym value. |
87 EVENTS_EXPORT uint32 PlatformKeycodeFromNative( | 89 EVENTS_EXPORT uint32 PlatformKeycodeFromNative( |
88 const base::NativeEvent& native_event); | 90 const base::NativeEvent& native_event); |
89 | 91 |
90 // Returns the windows key code. Note that this value is different from | |
91 // KeyboardCodeFromNative (there is a divergence between ui::KeyboardCode and | |
92 // windows key codes). | |
93 EVENTS_EXPORT uint32 WindowsKeycodeFromNative( | |
94 const base::NativeEvent& native_event); | |
95 | |
96 // Returns the text generated by this keystroke. Used in the value we pass to | |
97 // blink. | |
98 EVENTS_EXPORT uint16 TextFromNative(const base::NativeEvent& native_event); | |
99 | |
100 // Returns the unmodified text generated by this keystroke. Used in the value | |
101 // we pass to blink. | |
102 EVENTS_EXPORT uint16 UnmodifiedTextFromNative( | |
103 const base::NativeEvent& native_event); | |
104 | |
105 #if defined(OS_LINUX) | |
106 // Returns a control character sequences from a |windows_key_code|. | 92 // Returns a control character sequences from a |windows_key_code|. |
107 EVENTS_EXPORT uint16 GetControlCharacterForKeycode(int windows_key_code, | 93 EVENTS_EXPORT base::char16 GetControlCharacterForKeycode(int windows_key_code, |
108 bool shift); | 94 bool shift); |
109 #endif | |
110 | 95 |
111 // Returns true if the keyboard event is a character event rather than | 96 // Returns true if the keyboard event is a character event rather than |
112 // a keystroke event. | 97 // a keystroke event. |
113 EVENTS_EXPORT bool IsCharFromNative(const base::NativeEvent& native_event); | 98 EVENTS_EXPORT bool IsCharFromNative(const base::NativeEvent& native_event); |
114 | 99 |
115 // Returns the flags of the button that changed during a press/release. | 100 // Returns the flags of the button that changed during a press/release. |
116 EVENTS_EXPORT int GetChangedMouseButtonFlagsFromNative( | 101 EVENTS_EXPORT int GetChangedMouseButtonFlagsFromNative( |
117 const base::NativeEvent& native_event); | 102 const base::NativeEvent& native_event); |
118 | 103 |
119 // Gets the mouse wheel offsets from a native event. | 104 // Gets the mouse wheel offsets from a native event. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // Update the native X11 event to correspond to the new button flags. | 181 // Update the native X11 event to correspond to the new button flags. |
197 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); | 182 EVENTS_EXPORT void UpdateX11EventForChangedButtonFlags(MouseEvent* event); |
198 #endif | 183 #endif |
199 | 184 |
200 // Registers a custom event type. | 185 // Registers a custom event type. |
201 EVENTS_EXPORT int RegisterCustomEventType(); | 186 EVENTS_EXPORT int RegisterCustomEventType(); |
202 | 187 |
203 } // namespace ui | 188 } // namespace ui |
204 | 189 |
205 #endif // UI_EVENTS_EVENT_UTILS_H_ | 190 #endif // UI_EVENTS_EVENT_UTILS_H_ |
OLD | NEW |