summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/web_input_event_aurawin.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-14 17:25:10 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-14 17:25:10 +0000
commitc3125e0cd04419e07a6eab1ab2a4f43b315027b8 (patch)
tree9093bab8a313afa6f88c0b90125abac1bb5d86fa /content/browser/renderer_host/web_input_event_aurawin.cc
parenta1d291615b8e8ee9cb3d9edc8fefde70ed8cb535 (diff)
downloadchromium_src-c3125e0cd04419e07a6eab1ab2a4f43b315027b8.zip
chromium_src-c3125e0cd04419e07a6eab1ab2a4f43b315027b8.tar.gz
chromium_src-c3125e0cd04419e07a6eab1ab2a4f43b315027b8.tar.bz2
Adds factories for WebInputEvents for Aura.
Explanation: WebKit::WebInputEvent uses more state from the original native event than aura::Event or views::Event expose. I'd rather not expose all of this in platform-neutral ways on aura::Event, since we don't really need any of it. So instead my approach was to create an appropriate WebInputEvent, initialize it directly from the underlying platform event, and then replace the position values with the translated ones on the aura::Event, since that's the only really Aura-specific bit. For Windows, we can just use the factory method in the chromium API. For X11, we need to write the factory ourselves since there isn't one in WebKit. This code isn't used by anything yet. I'll start using it in RenderWidgetHostViewAura next. http://crbug.com/99757 TEST=none Review URL: http://codereview.chromium.org/8277027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/web_input_event_aurawin.cc')
-rw-r--r--content/browser/renderer_host/web_input_event_aurawin.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/content/browser/renderer_host/web_input_event_aurawin.cc b/content/browser/renderer_host/web_input_event_aurawin.cc
new file mode 100644
index 0000000..d13b31f
--- /dev/null
+++ b/content/browser/renderer_host/web_input_event_aurawin.cc
@@ -0,0 +1,31 @@
+// 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.
+
+#include "content/browser/renderer_host/web_input_event_aura.h"
+
+#include "base/event_types.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFactory.h"
+
+namespace content {
+
+// On Windows, we can just use the builtin WebKit factory methods to fully
+// construct our pre-translated events.
+
+WebKit::WebMouseEvent MakeUntranslatedWebMouseEventFromNativeEvent(
+ base::NativeEvent native_event) {
+ return WebKit::WebInputEventFactory::mouseEvent(native_event.hwnd,
+ native_event.message,
+ native_event.wParam,
+ native_event.lParam);
+}
+
+WebKit::WebKeyboardEvent MakeWebKeyboardEventFromNativeEvent(
+ base::NativeEvent native_event) {
+ return WebKit::WebInputEventFactory::keyboardEvent(native_event.hwnd,
+ native_event.message,
+ native_event.wParam,
+ native_event.lParam);
+}
+
+} // namespace content