[email protected] | d74cec8 | 2009-03-06 20:50:52 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ | ||||
6 | #define CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ | ||||
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
[email protected] | d74cec8 | 2009-03-06 20:50:52 | [diff] [blame] | 8 | |
9 | #include "base/basictypes.h" | ||||
[email protected] | 418ed5ab | 2009-11-12 01:14:49 | [diff] [blame] | 10 | #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
[email protected] | d74cec8 | 2009-03-06 20:50:52 | [diff] [blame] | 11 | |
12 | #if defined(OS_WIN) | ||||
13 | #include <windows.h> | ||||
14 | #elif defined(OS_MACOSX) | ||||
15 | #ifdef __OBJC__ | ||||
16 | @class NSEvent; | ||||
17 | #else | ||||
18 | class NSEvent; | ||||
19 | #endif // __OBJC__ | ||||
[email protected] | 031e4d3 | 2009-12-29 01:13:23 | [diff] [blame] | 20 | #elif defined(OS_POSIX) |
21 | typedef struct _GdkEventKey GdkEventKey; | ||||
[email protected] | d74cec8 | 2009-03-06 20:50:52 | [diff] [blame] | 22 | #endif |
23 | |||||
24 | // Owns a platform specific event; used to pass own and pass event through | ||||
25 | // platform independent code. | ||||
[email protected] | 62cb33cae | 2009-03-27 23:30:22 | [diff] [blame] | 26 | struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent { |
[email protected] | d74cec8 | 2009-03-06 20:50:52 | [diff] [blame] | 27 | NativeWebKeyboardEvent(); |
28 | |||||
29 | #if defined(OS_WIN) | ||||
30 | NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); | ||||
31 | #elif defined(OS_MACOSX) | ||||
32 | explicit NativeWebKeyboardEvent(NSEvent *event); | ||||
[email protected] | f17709b | 2009-08-03 07:38:06 | [diff] [blame] | 33 | NativeWebKeyboardEvent(wchar_t character, |
34 | int state, | ||||
35 | double time_stamp_seconds); | ||||
[email protected] | 3faa467 | 2010-08-06 21:34:43 | [diff] [blame] | 36 | #elif defined(TOOLKIT_USES_GTK) |
[email protected] | d74cec8 | 2009-03-06 20:50:52 | [diff] [blame] | 37 | explicit NativeWebKeyboardEvent(const GdkEventKey* event); |
[email protected] | feab536 | 2009-07-01 04:41:53 | [diff] [blame] | 38 | NativeWebKeyboardEvent(wchar_t character, |
39 | int state, | ||||
40 | double time_stamp_seconds); | ||||
[email protected] | d74cec8 | 2009-03-06 20:50:52 | [diff] [blame] | 41 | #endif |
42 | |||||
43 | NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event); | ||||
44 | ~NativeWebKeyboardEvent(); | ||||
45 | |||||
46 | NativeWebKeyboardEvent& operator=(const NativeWebKeyboardEvent& event); | ||||
47 | |||||
48 | #if defined(OS_WIN) | ||||
49 | MSG os_event; | ||||
50 | #elif defined(OS_MACOSX) | ||||
51 | NSEvent* os_event; | ||||
[email protected] | 3faa467 | 2010-08-06 21:34:43 | [diff] [blame] | 52 | #elif defined(TOOLKIT_USES_GTK) |
[email protected] | ad53baa5 | 2010-03-01 04:49:06 | [diff] [blame] | 53 | GdkEventKey* os_event; |
54 | #endif | ||||
[email protected] | 3ae1feb6 | 2009-10-19 03:13:31 | [diff] [blame] | 55 | |
56 | // True if the browser should ignore this event if it's not handled by the | ||||
57 | // renderer. This happens for RawKeyDown events that are created while IME is | ||||
58 | // active and is necessary to prevent backspace from doing "history back" if | ||||
59 | // it is hit in ime mode. | ||||
[email protected] | ad53baa5 | 2010-03-01 04:49:06 | [diff] [blame] | 60 | // Currently, it's only used by Linux and Mac ports. |
[email protected] | 3ae1feb6 | 2009-10-19 03:13:31 | [diff] [blame] | 61 | bool skip_in_browser; |
[email protected] | d74cec8 | 2009-03-06 20:50:52 | [diff] [blame] | 62 | }; |
63 | |||||
64 | #endif // CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ |