OLD | NEW |
| (Empty) |
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_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | |
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__ | |
20 #elif defined(OS_POSIX) | |
21 typedef struct _GdkEventKey GdkEventKey; | |
22 #endif | |
23 | |
24 // Owns a platform specific event; used to pass own and pass event through | |
25 // platform independent code. | |
26 struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent { | |
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); | |
33 NativeWebKeyboardEvent(wchar_t character, | |
34 int state, | |
35 double time_stamp_seconds); | |
36 #elif defined(TOOLKIT_USES_GTK) | |
37 explicit NativeWebKeyboardEvent(const GdkEventKey* event); | |
38 NativeWebKeyboardEvent(wchar_t character, | |
39 int state, | |
40 double time_stamp_seconds); | |
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; | |
52 #elif defined(TOOLKIT_USES_GTK) | |
53 GdkEventKey* os_event; | |
54 #endif | |
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. | |
60 // Currently, it's only used by Linux and Mac ports. | |
61 bool skip_in_browser; | |
62 | |
63 #if defined(OS_LINUX) | |
64 // True if the key event matches an edit command. In order to ensure the edit | |
65 // command always work in web page, the browser should not pre-handle this key | |
66 // event as a reserved accelerator. See http://crbug.com/54573 | |
67 bool match_edit_command; | |
68 #endif | |
69 }; | |
70 | |
71 #endif // CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_ | |
OLD | NEW |