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