summaryrefslogtreecommitdiffstats
path: root/content/common/native_web_keyboard_event.h
diff options
context:
space:
mode:
authorsuzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 22:59:32 +0000
committersuzhe@google.com <suzhe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-01 22:59:32 +0000
commit4b99402b089ba598ae26c82d99c3c3d2fe0cd574 (patch)
treef4fe9b7a92bc90b364c40b901919fee163b7061b /content/common/native_web_keyboard_event.h
parent4b8b6d844d019a612a02274d298e3dcffc42276b (diff)
downloadchromium_src-4b99402b089ba598ae26c82d99c3c3d2fe0cd574.zip
chromium_src-4b99402b089ba598ae26c82d99c3c3d2fe0cd574.tar.gz
chromium_src-4b99402b089ba598ae26c82d99c3c3d2fe0cd574.tar.bz2
Refactor RenderWidgetHostViewViews to use the new input method API for Views.
This CL also fixes some issues related to NULL host_ pointer in the original code. Hope the fixes are correct. Another side effect of this CL is: it converts views::KeyEvent to NativeWebKeyboardEvent by using the conversion table of Views instead of WebInputEventFactory provided by WebKit. See bug 54315. BUG=54315 BUG=75003 TEST=none Review URL: http://codereview.chromium.org/6713083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/native_web_keyboard_event.h')
-rw-r--r--content/common/native_web_keyboard_event.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/content/common/native_web_keyboard_event.h b/content/common/native_web_keyboard_event.h
index 08de652..6e94a34 100644
--- a/content/common/native_web_keyboard_event.h
+++ b/content/common/native_web_keyboard_event.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#pragma once
#include "base/basictypes.h"
+#include "build/build_config.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#if defined(OS_WIN)
@@ -21,6 +22,12 @@ class NSEvent;
typedef struct _GdkEventKey GdkEventKey;
#endif
+#if defined(TOOLKIT_VIEWS)
+namespace views {
+class KeyEvent;
+}
+#endif
+
// Owns a platform specific event; used to pass own and pass event through
// platform independent code.
struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
@@ -34,12 +41,31 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
int state,
double time_stamp_seconds);
#elif defined(TOOLKIT_USES_GTK)
+ // TODO(suzhe): Limit these constructors to Linux native Gtk port.
+ // For Linux Views port, after using RenderWidgetHostViewViews to replace
+ // RenderWidgetHostViewGtk, we can use constructors for TOOLKIT_VIEWS defined
+ // below.
explicit NativeWebKeyboardEvent(const GdkEventKey* event);
NativeWebKeyboardEvent(wchar_t character,
int state,
double time_stamp_seconds);
#endif
+#if defined(TOOLKIT_VIEWS)
+ // TODO(suzhe): remove once we get rid of Gtk from Views.
+ struct FromViewsEvent {};
+ // These two constructors are shared between Windows and Linux Views ports.
+ explicit NativeWebKeyboardEvent(const views::KeyEvent& event);
+ // TODO(suzhe): Sadly, we need to add a meanless FromViewsEvent parameter to
+ // distinguish between this contructor and above Gtk one, because they use
+ // different modifier flags. We can remove this extra parameter as soon as we
+ // disable above Gtk constructor in Linux Views port.
+ NativeWebKeyboardEvent(uint16 character,
+ int flags,
+ double time_stamp_seconds,
+ FromViewsEvent);
+#endif
+
NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event);
~NativeWebKeyboardEvent();