| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_PUBLIC_BROWSER_NATIVE_WEB_KEYBOARD_EVENT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NATIVE_WEB_KEYBOARD_EVENT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_NATIVE_WEB_KEYBOARD_EVENT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NATIVE_WEB_KEYBOARD_EVENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 14 #include "ui/base/events.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 15 | 16 |
| 16 // Owns a platform specific event; used to pass own and pass event through | 17 // Owns a platform specific event; used to pass own and pass event through |
| 17 // platform independent code. | 18 // platform independent code. |
| 18 struct CONTENT_EXPORT NativeWebKeyboardEvent : | 19 struct CONTENT_EXPORT NativeWebKeyboardEvent : |
| 19 NON_EXPORTED_BASE(public WebKit::WebKeyboardEvent) { | 20 NON_EXPORTED_BASE(public WebKit::WebKeyboardEvent) { |
| 20 NativeWebKeyboardEvent(); | 21 NativeWebKeyboardEvent(); |
| 21 | 22 |
| 22 explicit NativeWebKeyboardEvent(gfx::NativeEvent native_event); | 23 explicit NativeWebKeyboardEvent(gfx::NativeEvent native_event); |
| 23 #if defined(OS_MACOSX) || defined(TOOLKIT_USES_GTK) | 24 #if defined(OS_MACOSX) || defined(TOOLKIT_USES_GTK) |
| 24 // TODO(suzhe): Limit these constructors to Linux native Gtk port. | 25 // TODO(suzhe): Limit these constructors to Linux native Gtk port. |
| 25 // For Linux Views port, after using RenderWidgetHostViewViews to replace | 26 // For Linux Views port, after using RenderWidgetHostViewViews to replace |
| 26 // RenderWidgetHostViewGtk, we can use constructors for TOOLKIT_VIEWS defined | 27 // RenderWidgetHostViewGtk, we can use constructors for TOOLKIT_VIEWS defined |
| 27 // below. | 28 // below. |
| 28 NativeWebKeyboardEvent(wchar_t character, | 29 NativeWebKeyboardEvent(wchar_t character, |
| 29 int state, | 30 int state, |
| 30 double time_stamp_seconds); | 31 double time_stamp_seconds); |
| 31 #endif | 32 #endif |
| 33 #if defined(USE_AURA) |
| 34 NativeWebKeyboardEvent(ui::EventType type, |
| 35 bool is_char, |
| 36 wchar_t character, |
| 37 int state, |
| 38 double time_stamp_seconds); |
| 39 #endif |
| 32 | 40 |
| 33 NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event); | 41 NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 34 ~NativeWebKeyboardEvent(); | 42 ~NativeWebKeyboardEvent(); |
| 35 | 43 |
| 36 NativeWebKeyboardEvent& operator=(const NativeWebKeyboardEvent& event); | 44 NativeWebKeyboardEvent& operator=(const NativeWebKeyboardEvent& event); |
| 37 | 45 |
| 38 gfx::NativeEvent os_event; | 46 gfx::NativeEvent os_event; |
| 39 | 47 |
| 40 // True if the browser should ignore this event if it's not handled by the | 48 // True if the browser should ignore this event if it's not handled by the |
| 41 // renderer. This happens for RawKeyDown events that are created while IME is | 49 // renderer. This happens for RawKeyDown events that are created while IME is |
| 42 // active and is necessary to prevent backspace from doing "history back" if | 50 // active and is necessary to prevent backspace from doing "history back" if |
| 43 // it is hit in ime mode. | 51 // it is hit in ime mode. |
| 44 // Currently, it's only used by Linux and Mac ports. | 52 // Currently, it's only used by Linux and Mac ports. |
| 45 bool skip_in_browser; | 53 bool skip_in_browser; |
| 46 | 54 |
| 47 #if defined(TOOLKIT_USES_GTK) | 55 #if defined(TOOLKIT_USES_GTK) |
| 48 // True if the key event matches an edit command. In order to ensure the edit | 56 // True if the key event matches an edit command. In order to ensure the edit |
| 49 // command always work in web page, the browser should not pre-handle this key | 57 // command always work in web page, the browser should not pre-handle this key |
| 50 // event as a reserved accelerator. See http://crbug.com/54573 | 58 // event as a reserved accelerator. See http://crbug.com/54573 |
| 51 bool match_edit_command; | 59 bool match_edit_command; |
| 52 #endif | 60 #endif |
| 53 }; | 61 }; |
| 54 | 62 |
| 55 #endif // CONTENT_PUBLIC_BROWSER_NATIVE_WEB_KEYBOARD_EVENT_H_ | 63 #endif // CONTENT_PUBLIC_BROWSER_NATIVE_WEB_KEYBOARD_EVENT_H_ |
| OLD | NEW |