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