Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 26664002: SyntheticGestureTarget implementation for injecting synthetic input events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: styles Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index cc2f3df7edab345611ef717c9a36fd4a2114b81b..d1750e4bf2a2c92d30e51227c1e4dc6659d840f3 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -33,6 +33,8 @@
#include "content/browser/renderer_host/web_input_event_aura.h"
#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/gpu_messages.h"
+#include "content/common/input/input_event.h"
+#include "content/common/input/web_input_event_payload.h"
#include "content/common/view_messages.h"
#include "content/port/browser/render_widget_host_view_frame_subscriber.h"
#include "content/port/browser/render_widget_host_view_port.h"
@@ -89,6 +91,7 @@ using gfx::RectToSkIRect;
using gfx::SkIRectToRect;
using WebKit::WebScreenInfo;
+using WebKit::WebInputEvent;
using WebKit::WebTouchEvent;
namespace content {
@@ -2134,6 +2137,54 @@ void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
}
}
+void RenderWidgetHostViewAura::QueueInputEventToPlatform(
+ const InputEvent& event) {
+ aura::RootWindow* root_window = window_->GetRootWindow();
+ if (!root_window)
+ return;
+
+ aura::RootWindowHostDelegate* root_window_host_delegate =
+ root_window->AsRootWindowHostDelegate();
+
+ DCHECK(event.valid());
+ DCHECK_EQ(InputEvent::Payload::WEB_INPUT_EVENT, event.payload()->GetType());
+
+ const WebInputEventPayload* payload =
+ WebInputEventPayload::Cast(event.payload());
+ const WebInputEvent* web_event = payload->web_event();
+ if (WebInputEvent::isTouchEventType(web_event->type)) {
+ ScopedVector<ui::TouchEvent> events;
+
+ const WebTouchEvent* web_touch =
+ static_cast<const WebTouchEvent*>(web_event);
+
+ TouchEventWithLatencyInfo touch_with_latency(
+ *web_touch, payload->latency_info());
+
+ // SyntheticGesture may skip calculating screenPosition, so we will fill it
+ // in here. "screenPosition" is converted from "position".
+ const unsigned num_touches = touch_with_latency.event.touchesLength;
+ for (unsigned i = 0; i < num_touches; ++ i) {
+ WebKit::WebTouchPoint* point = &touch_with_latency.event.touches[i];
+ gfx::Point position(point->position.x, point->position.y);
+ aura::Window::ConvertPointToTarget(window_, root_window, &position);
+ root_window->ConvertPointToHost(&position);
+ point->screenPosition.x = position.x();
+ point->screenPosition.y = position.y();
+ }
+
+ if (!MakeUITouchEventsFromWebTouchEvents(touch_with_latency, &events,
+ SCREEN_COORDINATES))
+ return;
+
+ for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(),
+ end = events.end(); iter != end; ++iter) {
+ root_window_host_delegate->OnHostTouchEvent(*iter);
+ }
+ } else
+ NOTREACHED(); // FIXME: implement other types (MouseWheel?)
+}
+
SyntheticGesture* RenderWidgetHostViewAura::CreateSmoothScrollGesture(
bool scroll_down,
int pixels_to_scroll,

Powered by Google App Engine
This is Rietveld 408576698