Chromium Code Reviews| Index: content/browser/renderer_host/input/synthetic_gesture_target_base.cc |
| diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_base.cc b/content/browser/renderer_host/input/synthetic_gesture_target_base.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b083a2f0d04e33d630e94d834823384477ff5120 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/input/synthetic_gesture_target_base.cc |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" |
| + |
| +#include "content/browser/renderer_host/ui_events_helper.h" |
| +#include "content/common/input/input_event.h" |
| +#include "content/public/browser/render_widget_host_view.h" |
| +#include "ui/events/event.h" |
| +#include "ui/events/latency_info.h" |
| + |
| +using WebKit::WebInputEvent; |
| +using WebKit::WebTouchEvent; |
| + |
| +namespace content { |
| + |
| +namespace { |
| + |
| +// How many milliseconds apart synthetic scroll messages should be sent. |
| +const int kSyntheticGestureMessageIntervalMs = 7; |
| + |
| +} // namespace |
| + |
| +SyntheticGestureTargetBase::SyntheticGestureTargetBase( |
| + RenderWidgetHostView* render_view) |
| + : render_view_(render_view) { |
| +} |
| + |
| +void SyntheticGestureTargetBase::QueueInputEventToPlatform( |
| + const InputEvent& event) { |
| + const WebInputEvent* web_event = event.web_event.get(); |
| + if (WebInputEvent::isTouchEventType(web_event->type)) { |
| + ScopedVector<ui::TouchEvent> events; |
| + |
| + const WebTouchEvent* web_touch = |
| + static_cast<const WebTouchEvent*>(web_event); |
| + |
| + QueueWebTouchEventToPlatform(*web_touch, event.latency_info); |
| + } else |
| + NOTREACHED(); // FIXME: implement other types (MouseWheel?) |
| +} |
| + |
| +void SyntheticGestureTargetBase::OnSyntheticGestureCompleted( |
| + SyntheticGestureNew::Result result) { |
| +} |
| + |
| +base::TimeDelta |
| +SyntheticGestureTargetBase::GetSyntheticGestureUpdateRate() const { |
| + return base::TimeDelta::FromMilliseconds(kSyntheticGestureMessageIntervalMs); |
| +} |
| + |
| +SyntheticGestureParams::GestureSourceType |
| +SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { |
| + return SyntheticGestureParams::TOUCH_INPUT; |
|
Dominik Grewe
2013/10/25 16:10:11
I'd say we use mouse input as the default on base,
kouhei (in TOK)
2013/10/28 03:03:17
Done.
|
| +} |
| + |
| +bool SyntheticGestureTargetBase::SupportsSyntheticGestureSourceType( |
| + SyntheticGestureParams::GestureSourceType gesture_source_type) const { |
| + // FIXME: add support for mouse |
| + return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; |
| +} |
| + |
| +} // namespace content |