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) { |
| 26 DCHECK(host); | |
| 25 } | 27 } |
| 26 | 28 |
| 27 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { | 29 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { |
| 28 } | 30 } |
| 29 | 31 |
| 30 void SyntheticGestureTargetBase::DispatchInputEventToPlatform( | 32 void SyntheticGestureTargetBase::DispatchInputEventToPlatform( |
| 31 const InputEvent& event) { | 33 const InputEvent& event) { |
| 32 const WebInputEvent* web_event = event.web_event.get(); | 34 const WebInputEvent* web_event = event.web_event.get(); |
| 33 if (WebInputEvent::isTouchEventType(web_event->type)) { | 35 if (WebInputEvent::isTouchEventType(web_event->type)) { |
| 34 DCHECK(SupportsSyntheticGestureSourceType( | 36 DCHECK(SupportsSyntheticGestureSourceType( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 } | 72 } |
| 71 | 73 |
| 72 void SyntheticGestureTargetBase::DispatchWebMouseEventToPlatform( | 74 void SyntheticGestureTargetBase::DispatchWebMouseEventToPlatform( |
| 73 const blink::WebMouseEvent& web_mouse, | 75 const blink::WebMouseEvent& web_mouse, |
| 74 const ui::LatencyInfo& latency_info) { | 76 const ui::LatencyInfo& latency_info) { |
| 75 host_->ForwardMouseEventWithLatencyInfo( | 77 host_->ForwardMouseEventWithLatencyInfo( |
| 76 MouseEventWithLatencyInfo(web_mouse, latency_info)); | 78 MouseEventWithLatencyInfo(web_mouse, latency_info)); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void SyntheticGestureTargetBase::OnSyntheticGestureCompleted( | 81 void SyntheticGestureTargetBase::OnSyntheticGestureCompleted( |
| 80 SyntheticGestureNew::Result result) { | 82 SyntheticGesture::Result result) { |
| 83 // Ignoring the result for now. | |
|
piman
2013/11/19 20:45:18
nit: is that a TODO / is there a bug? Otherwise, j
Dominik Grewe
2013/11/20 10:16:32
We currently don't plan to use the result but may
| |
| 84 host_->Send(new InputMsg_SyntheticGestureCompleted(host_->GetRoutingID())); | |
| 81 } | 85 } |
| 82 | 86 |
| 83 void SyntheticGestureTargetBase::SetNeedsFlush() { | 87 void SyntheticGestureTargetBase::SetNeedsFlush() { |
| 84 host_->SetNeedsFlush(); | 88 host_->SetNeedsFlush(); |
| 85 } | 89 } |
| 86 | 90 |
| 87 SyntheticGestureParams::GestureSourceType | 91 SyntheticGestureParams::GestureSourceType |
| 88 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { | 92 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { |
| 89 return SyntheticGestureParams::MOUSE_INPUT; | 93 return SyntheticGestureParams::MOUSE_INPUT; |
| 90 } | 94 } |
| 91 | 95 |
| 92 bool SyntheticGestureTargetBase::SupportsSyntheticGestureSourceType( | 96 bool SyntheticGestureTargetBase::SupportsSyntheticGestureSourceType( |
| 93 SyntheticGestureParams::GestureSourceType gesture_source_type) const { | 97 SyntheticGestureParams::GestureSourceType gesture_source_type) const { |
| 94 return gesture_source_type == SyntheticGestureParams::MOUSE_INPUT || | 98 return gesture_source_type == SyntheticGestureParams::MOUSE_INPUT || |
| 95 gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; | 99 gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; |
| 96 } | 100 } |
| 97 | 101 |
| 98 } // namespace content | 102 } // namespace content |
| OLD | NEW |