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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/browser/renderer_host/backing_store_aura.h" 25 #include "content/browser/renderer_host/backing_store_aura.h"
26 #include "content/browser/renderer_host/dip_util.h" 26 #include "content/browser/renderer_host/dip_util.h"
27 #include "content/browser/renderer_host/overscroll_controller.h" 27 #include "content/browser/renderer_host/overscroll_controller.h"
28 #include "content/browser/renderer_host/render_view_host_delegate.h" 28 #include "content/browser/renderer_host/render_view_host_delegate.h"
29 #include "content/browser/renderer_host/render_widget_host_impl.h" 29 #include "content/browser/renderer_host/render_widget_host_impl.h"
30 #include "content/browser/renderer_host/touch_smooth_scroll_gesture_aura.h" 30 #include "content/browser/renderer_host/touch_smooth_scroll_gesture_aura.h"
31 #include "content/browser/renderer_host/ui_events_helper.h" 31 #include "content/browser/renderer_host/ui_events_helper.h"
32 #include "content/browser/renderer_host/web_input_event_aura.h" 32 #include "content/browser/renderer_host/web_input_event_aura.h"
33 #include "content/common/gpu/client/gl_helper.h" 33 #include "content/common/gpu/client/gl_helper.h"
34 #include "content/common/gpu/gpu_messages.h" 34 #include "content/common/gpu/gpu_messages.h"
35 #include "content/common/input/input_event.h"
36 #include "content/common/input/web_input_event_payload.h"
35 #include "content/common/view_messages.h" 37 #include "content/common/view_messages.h"
36 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" 38 #include "content/port/browser/render_widget_host_view_frame_subscriber.h"
37 #include "content/port/browser/render_widget_host_view_port.h" 39 #include "content/port/browser/render_widget_host_view_port.h"
38 #include "content/public/browser/browser_thread.h" 40 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/content_browser_client.h" 41 #include "content/public/browser/content_browser_client.h"
40 #include "content/public/browser/render_process_host.h" 42 #include "content/public/browser/render_process_host.h"
41 #include "content/public/browser/render_view_host.h" 43 #include "content/public/browser/render_view_host.h"
42 #include "content/public/browser/user_metrics.h" 44 #include "content/public/browser/user_metrics.h"
43 #include "content/public/common/content_switches.h" 45 #include "content/public/common/content_switches.h"
44 #include "media/base/video_util.h" 46 #include "media/base/video_util.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 #include "content/browser/accessibility/browser_accessibility_win.h" 83 #include "content/browser/accessibility/browser_accessibility_win.h"
82 #include "ui/base/win/hidden_window.h" 84 #include "ui/base/win/hidden_window.h"
83 #include "ui/gfx/gdi_util.h" 85 #include "ui/gfx/gdi_util.h"
84 #include "ui/gfx/win/dpi.h" 86 #include "ui/gfx/win/dpi.h"
85 #endif 87 #endif
86 88
87 using gfx::RectToSkIRect; 89 using gfx::RectToSkIRect;
88 using gfx::SkIRectToRect; 90 using gfx::SkIRectToRect;
89 91
90 using WebKit::WebScreenInfo; 92 using WebKit::WebScreenInfo;
93 using WebKit::WebInputEvent;
91 using WebKit::WebTouchEvent; 94 using WebKit::WebTouchEvent;
92 95
93 namespace content { 96 namespace content {
94 97
95 void ReleaseMailbox(scoped_refptr<MemoryHolder> holder, 98 void ReleaseMailbox(scoped_refptr<MemoryHolder> holder,
96 unsigned sync_point, 99 unsigned sync_point,
97 bool lost_resource) {} 100 bool lost_resource) {}
98 101
99 class MemoryHolder : public base::RefCounted<MemoryHolder> { 102 class MemoryHolder : public base::RefCounted<MemoryHolder> {
100 public: 103 public:
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 return; 2100 return;
2098 2101
2099 ui::EventResult result = (ack_result == 2102 ui::EventResult result = (ack_result ==
2100 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; 2103 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED;
2101 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), 2104 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(),
2102 end = events.end(); iter != end; ++iter) { 2105 end = events.end(); iter != end; ++iter) {
2103 root->ProcessedTouchEvent((*iter), window_, result); 2106 root->ProcessedTouchEvent((*iter), window_, result);
2104 } 2107 }
2105 } 2108 }
2106 2109
2110 void RenderWidgetHostViewAura::QueueInputEventToPlatform(
2111 const InputEvent& event) {
2112 aura::RootWindow* root_window = window_->GetRootWindow();
2113 if (!root_window)
2114 return;
2115
2116 aura::RootWindowHostDelegate* root_window_host_delegate =
2117 root_window->AsRootWindowHostDelegate();
2118
2119 DCHECK(event.valid());
2120 DCHECK_EQ(InputEvent::Payload::WEB_INPUT_EVENT, event.payload()->GetType());
2121
2122 const WebInputEventPayload* payload =
2123 WebInputEventPayload::Cast(event.payload());
2124 const WebInputEvent* web_event = payload->web_event();
2125 if (WebInputEvent::isTouchEventType(web_event->type)) {
2126 ScopedVector<ui::TouchEvent> events;
2127
2128 const WebTouchEvent* web_touch =
2129 static_cast<const WebTouchEvent*>(web_event);
2130
2131 TouchEventWithLatencyInfo touch_with_latency(
2132 *web_touch, payload->latency_info());
2133
2134 // SyntheticGesture may skip calculating screenPosition, so we will fill it
2135 // in here. "screenPosition" is converted from "position".
2136 const unsigned num_touches = touch_with_latency.event.touchesLength;
2137 for (unsigned i = 0; i < num_touches; ++ i) {
2138 WebKit::WebTouchPoint* point = &touch_with_latency.event.touches[i];
2139 gfx::Point position(point->position.x, point->position.y);
2140 aura::Window::ConvertPointToTarget(window_, root_window, &position);
2141 root_window->ConvertPointToHost(&position);
2142 point->screenPosition.x = position.x();
2143 point->screenPosition.y = position.y();
2144 }
2145
2146 if (!MakeUITouchEventsFromWebTouchEvents(touch_with_latency, &events,
2147 SCREEN_COORDINATES))
2148 return;
2149
2150 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(),
2151 end = events.end(); iter != end; ++iter) {
2152 root_window_host_delegate->OnHostTouchEvent(*iter);
2153 }
2154 } else
2155 NOTREACHED(); // FIXME: implement other types (MouseWheel?)
2156 }
2157
2107 SyntheticGesture* RenderWidgetHostViewAura::CreateSmoothScrollGesture( 2158 SyntheticGesture* RenderWidgetHostViewAura::CreateSmoothScrollGesture(
2108 bool scroll_down, 2159 bool scroll_down,
2109 int pixels_to_scroll, 2160 int pixels_to_scroll,
2110 int mouse_event_x, 2161 int mouse_event_x,
2111 int mouse_event_y) { 2162 int mouse_event_y) {
2112 return new TouchSmoothScrollGestureAura(scroll_down, 2163 return new TouchSmoothScrollGestureAura(scroll_down,
2113 pixels_to_scroll, 2164 pixels_to_scroll,
2114 mouse_event_x, 2165 mouse_event_x,
2115 mouse_event_y, 2166 mouse_event_y,
2116 window_); 2167 window_);
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3387 RenderWidgetHost* widget) { 3438 RenderWidgetHost* widget) {
3388 return new RenderWidgetHostViewAura(widget); 3439 return new RenderWidgetHostViewAura(widget);
3389 } 3440 }
3390 3441
3391 // static 3442 // static
3392 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3443 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3393 GetScreenInfoForWindow(results, NULL); 3444 GetScreenInfoForWindow(results, NULL);
3394 } 3445 }
3395 3446
3396 } // namespace content 3447 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698