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_base.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.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_base.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
9 #include "content/browser/renderer_host/ui_events_helper.h" | 9 #include "content/browser/renderer_host/ui_events_helper.h" |
10 #include "content/common/input/input_event.h" | 10 #include "content/common/input/input_event.h" |
11 #include "content/common/input_messages.h" | |
12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 11 #include "third_party/WebKit/public/web/WebInputEvent.h" |
13 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
14 #include "ui/events/latency_info.h" | 13 #include "ui/events/latency_info.h" |
15 | 14 |
16 using blink::WebInputEvent; | 15 using blink::WebInputEvent; |
17 using blink::WebTouchEvent; | 16 using blink::WebTouchEvent; |
18 using blink::WebMouseEvent; | 17 using blink::WebMouseEvent; |
19 using blink::WebMouseWheelEvent; | 18 using blink::WebMouseWheelEvent; |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 | 21 |
23 SyntheticGestureTargetBase::SyntheticGestureTargetBase( | 22 SyntheticGestureTargetBase::SyntheticGestureTargetBase( |
24 RenderWidgetHostImpl* host) | 23 RenderWidgetHostImpl* host) |
25 : host_(host) { | 24 : host_(host) { |
26 DCHECK(host); | |
27 } | 25 } |
28 | 26 |
29 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { | 27 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { |
30 } | 28 } |
31 | 29 |
32 void SyntheticGestureTargetBase::DispatchInputEventToPlatform( | 30 void SyntheticGestureTargetBase::DispatchInputEventToPlatform( |
33 const InputEvent& event) { | 31 const InputEvent& event) { |
34 const WebInputEvent* web_event = event.web_event.get(); | 32 const WebInputEvent* web_event = event.web_event.get(); |
35 if (WebInputEvent::isTouchEventType(web_event->type)) { | 33 if (WebInputEvent::isTouchEventType(web_event->type)) { |
36 DCHECK(SupportsSyntheticGestureSourceType( | 34 DCHECK(SupportsSyntheticGestureSourceType( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 70 } |
73 | 71 |
74 void SyntheticGestureTargetBase::DispatchWebMouseEventToPlatform( | 72 void SyntheticGestureTargetBase::DispatchWebMouseEventToPlatform( |
75 const blink::WebMouseEvent& web_mouse, | 73 const blink::WebMouseEvent& web_mouse, |
76 const ui::LatencyInfo& latency_info) { | 74 const ui::LatencyInfo& latency_info) { |
77 host_->ForwardMouseEventWithLatencyInfo( | 75 host_->ForwardMouseEventWithLatencyInfo( |
78 MouseEventWithLatencyInfo(web_mouse, latency_info)); | 76 MouseEventWithLatencyInfo(web_mouse, latency_info)); |
79 } | 77 } |
80 | 78 |
81 void SyntheticGestureTargetBase::OnSyntheticGestureCompleted( | 79 void SyntheticGestureTargetBase::OnSyntheticGestureCompleted( |
82 SyntheticGesture::Result result) { | 80 SyntheticGestureNew::Result result) { |
83 host_->Send(new InputMsg_SyntheticGestureCompleted(host_->GetRoutingID())); | |
84 } | 81 } |
85 | 82 |
86 void SyntheticGestureTargetBase::SetNeedsFlush() { | 83 void SyntheticGestureTargetBase::SetNeedsFlush() { |
87 host_->SetNeedsFlush(); | 84 host_->SetNeedsFlush(); |
88 } | 85 } |
89 | 86 |
90 SyntheticGestureParams::GestureSourceType | 87 SyntheticGestureParams::GestureSourceType |
91 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { | 88 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { |
92 return SyntheticGestureParams::MOUSE_INPUT; | 89 return SyntheticGestureParams::MOUSE_INPUT; |
93 } | 90 } |
94 | 91 |
95 bool SyntheticGestureTargetBase::SupportsSyntheticGestureSourceType( | 92 bool SyntheticGestureTargetBase::SupportsSyntheticGestureSourceType( |
96 SyntheticGestureParams::GestureSourceType gesture_source_type) const { | 93 SyntheticGestureParams::GestureSourceType gesture_source_type) const { |
97 return gesture_source_type == SyntheticGestureParams::MOUSE_INPUT || | 94 return gesture_source_type == SyntheticGestureParams::MOUSE_INPUT || |
98 gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; | 95 gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; |
99 } | 96 } |
100 | 97 |
101 } // namespace content | 98 } // namespace content |
OLD | NEW |