OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/input/synthetic_gesture_target_aura.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
10 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 10 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
11 #include "content/browser/renderer_host/ui_events_helper.h" | 11 #include "content/browser/renderer_host/ui_events_helper.h" |
12 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | |
13 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
14 #include "ui/aura/window_tree_host.h" | 13 #include "ui/aura/window_tree_host.h" |
15 #include "ui/events/event_processor.h" | 14 #include "ui/events/event_processor.h" |
16 #include "ui/events/event_utils.h" | 15 #include "ui/events/event_utils.h" |
17 #include "ui/events/gesture_detection/gesture_configuration.h" | 16 #include "ui/events/gesture_detection/gesture_configuration.h" |
18 | 17 |
19 using blink::WebTouchEvent; | 18 using blink::WebTouchEvent; |
20 using blink::WebMouseWheelEvent; | 19 using blink::WebMouseWheelEvent; |
21 | 20 |
22 namespace content { | 21 namespace content { |
23 | 22 |
24 SyntheticGestureTargetAura::SyntheticGestureTargetAura( | 23 SyntheticGestureTargetAura::SyntheticGestureTargetAura( |
25 RenderWidgetHostImpl* host) | 24 RenderWidgetHostImpl* host) |
26 : SyntheticGestureTargetBase(host) { | 25 : SyntheticGestureTargetBase(host) { |
27 blink::WebScreenInfo screenInfo; | 26 ScreenInfo screen_info; |
28 host->GetWebScreenInfo(&screenInfo); | 27 host->GetScreenInfo(&screen_info); |
29 device_scale_factor_ = screenInfo.deviceScaleFactor; | 28 device_scale_factor_ = screen_info.device_scale_factor; |
30 } | 29 } |
31 | 30 |
32 void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform( | 31 void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform( |
33 const WebTouchEvent& web_touch, | 32 const WebTouchEvent& web_touch, |
34 const ui::LatencyInfo& latency_info) { | 33 const ui::LatencyInfo& latency_info) { |
35 TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info); | 34 TouchEventWithLatencyInfo touch_with_latency(web_touch, latency_info); |
36 for (size_t i = 0; i < touch_with_latency.event.touchesLength; i++) { | 35 for (size_t i = 0; i < touch_with_latency.event.touchesLength; i++) { |
37 touch_with_latency.event.touches[i].radiusX *= device_scale_factor_; | 36 touch_with_latency.event.touches[i].radiusX *= device_scale_factor_; |
38 touch_with_latency.event.touches[i].radiusY *= device_scale_factor_; | 37 touch_with_latency.event.touches[i].radiusY *= device_scale_factor_; |
39 } | 38 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 ->min_distance_for_pinch_scroll_in_pixels(); | 170 ->min_distance_for_pinch_scroll_in_pixels(); |
172 } | 171 } |
173 | 172 |
174 aura::Window* SyntheticGestureTargetAura::GetWindow() const { | 173 aura::Window* SyntheticGestureTargetAura::GetWindow() const { |
175 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); | 174 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); |
176 DCHECK(window); | 175 DCHECK(window); |
177 return window; | 176 return window; |
178 } | 177 } |
179 | 178 |
180 } // namespace content | 179 } // namespace content |
OLD | NEW |