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