blob: 4f6548ddd600ac5f0625c84e33d318e68a520606 [file] [log] [blame]
[email protected]d74cec82009-03-06 20:50:521// 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]32b76ef2010-07-26 23:08:247#pragma once
[email protected]d74cec82009-03-06 20:50:528
9#include "base/basictypes.h"
[email protected]418ed5ab2009-11-12 01:14:4910#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
[email protected]d74cec82009-03-06 20:50:5211
12#if defined(OS_WIN)
13#include <windows.h>
14#elif defined(OS_MACOSX)
15#ifdef __OBJC__
16@class NSEvent;
17#else
18class NSEvent;
19#endif // __OBJC__
[email protected]031e4d32009-12-29 01:13:2320#elif defined(OS_POSIX)
21typedef struct _GdkEventKey GdkEventKey;
[email protected]d74cec82009-03-06 20:50:5222#endif
23
24// Owns a platform specific event; used to pass own and pass event through
25// platform independent code.
[email protected]62cb33cae2009-03-27 23:30:2226struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
[email protected]d74cec82009-03-06 20:50:5227 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]f17709b2009-08-03 07:38:0633 NativeWebKeyboardEvent(wchar_t character,
34 int state,
35 double time_stamp_seconds);
[email protected]3faa4672010-08-06 21:34:4336#elif defined(TOOLKIT_USES_GTK)
[email protected]d74cec82009-03-06 20:50:5237 explicit NativeWebKeyboardEvent(const GdkEventKey* event);
[email protected]feab5362009-07-01 04:41:5338 NativeWebKeyboardEvent(wchar_t character,
39 int state,
40 double time_stamp_seconds);
[email protected]d74cec82009-03-06 20:50:5241#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]3faa4672010-08-06 21:34:4352#elif defined(TOOLKIT_USES_GTK)
[email protected]ad53baa52010-03-01 04:49:0653 GdkEventKey* os_event;
54#endif
[email protected]3ae1feb62009-10-19 03:13:3155
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]ad53baa52010-03-01 04:49:0660 // Currently, it's only used by Linux and Mac ports.
[email protected]3ae1feb62009-10-19 03:13:3161 bool skip_in_browser;
[email protected]d74cec82009-03-06 20:50:5262};
63
64#endif // CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_H_