| 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 "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 9 #include "content/browser/renderer_host/ui_events_helper.h" | 9 #include "content/browser/renderer_host/ui_events_helper.h" |
| 10 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 10 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 if (details.dispatcher_destroyed) | 52 if (details.dispatcher_destroyed) |
| 53 break; | 53 break; |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( | 57 void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( |
| 58 const blink::WebMouseWheelEvent& web_wheel, | 58 const blink::WebMouseWheelEvent& web_wheel, |
| 59 const ui::LatencyInfo&) { | 59 const ui::LatencyInfo&) { |
| 60 gfx::PointF location(web_wheel.x * device_scale_factor_, | 60 gfx::PointF location(web_wheel.x * device_scale_factor_, |
| 61 web_wheel.y * device_scale_factor_); | 61 web_wheel.y * device_scale_factor_); |
| 62 ui::MouseEvent mouse_event(ui::ET_MOUSEWHEEL, location, location, | 62 ui::MouseEvent mouse_event( |
| 63 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 63 ui::ET_MOUSEWHEEL, location, location, ui::EventTimeForNow(), ui::EF_NONE, |
| 64 ui::EF_NONE, |
| 65 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 64 ui::MouseWheelEvent wheel_event( | 66 ui::MouseWheelEvent wheel_event( |
| 65 mouse_event, web_wheel.deltaX, web_wheel.deltaY); | 67 mouse_event, web_wheel.deltaX, web_wheel.deltaY); |
| 66 | 68 |
| 67 aura::Window* window = GetWindow(); | 69 aura::Window* window = GetWindow(); |
| 68 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow()); | 70 wheel_event.ConvertLocationToTarget(window, window->GetRootWindow()); |
| 69 ui::EventDispatchDetails details = | 71 ui::EventDispatchDetails details = |
| 70 window->GetHost()->event_processor()->OnEventFromSource(&wheel_event); | 72 window->GetHost()->event_processor()->OnEventFromSource(&wheel_event); |
| 71 if (details.dispatcher_destroyed) | 73 if (details.dispatcher_destroyed) |
| 72 return; | 74 return; |
| 73 } | 75 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 125 |
| 124 } // namespace | 126 } // namespace |
| 125 | 127 |
| 126 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( | 128 void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( |
| 127 const blink::WebMouseEvent& web_mouse, | 129 const blink::WebMouseEvent& web_mouse, |
| 128 const ui::LatencyInfo& latency_info) { | 130 const ui::LatencyInfo& latency_info) { |
| 129 gfx::PointF location(web_mouse.x * device_scale_factor_, | 131 gfx::PointF location(web_mouse.x * device_scale_factor_, |
| 130 web_mouse.y * device_scale_factor_); | 132 web_mouse.y * device_scale_factor_); |
| 131 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type); | 133 ui::EventType event_type = WebMouseEventTypeToEventType(web_mouse.type); |
| 132 int flags = WebMouseEventButtonToFlags(web_mouse.button); | 134 int flags = WebMouseEventButtonToFlags(web_mouse.button); |
| 133 ui::MouseEvent mouse_event(event_type, location, location, | 135 ui::MouseEvent mouse_event( |
| 134 ui::EventTimeForNow(), flags, flags); | 136 event_type, location, location, ui::EventTimeForNow(), flags, flags, |
| 137 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 135 | 138 |
| 136 aura::Window* window = GetWindow(); | 139 aura::Window* window = GetWindow(); |
| 137 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); | 140 mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); |
| 138 ui::EventDispatchDetails details = | 141 ui::EventDispatchDetails details = |
| 139 window->GetHost()->event_processor()->OnEventFromSource(&mouse_event); | 142 window->GetHost()->event_processor()->OnEventFromSource(&mouse_event); |
| 140 if (details.dispatcher_destroyed) | 143 if (details.dispatcher_destroyed) |
| 141 return; | 144 return; |
| 142 } | 145 } |
| 143 | 146 |
| 144 SyntheticGestureParams::GestureSourceType | 147 SyntheticGestureParams::GestureSourceType |
| (...skipping 14 matching lines...) Expand all Loading... |
| 159 ->min_distance_for_pinch_scroll_in_pixels(); | 162 ->min_distance_for_pinch_scroll_in_pixels(); |
| 160 } | 163 } |
| 161 | 164 |
| 162 aura::Window* SyntheticGestureTargetAura::GetWindow() const { | 165 aura::Window* SyntheticGestureTargetAura::GetWindow() const { |
| 163 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); | 166 aura::Window* window = render_widget_host()->GetView()->GetNativeView(); |
| 164 DCHECK(window); | 167 DCHECK(window); |
| 165 return window; | 168 return window; |
| 166 } | 169 } |
| 167 | 170 |
| 168 } // namespace content | 171 } // namespace content |
| OLD | NEW |