Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture_target_base.cc

Issue 26664002: SyntheticGestureTarget implementation for injecting synthetic input events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase_wip Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h"
6
7 #include "content/browser/renderer_host/ui_events_helper.h"
8 #include "content/common/input/input_event.h"
9 #include "content/public/browser/render_widget_host_view.h"
10 #include "ui/events/event.h"
11 #include "ui/events/latency_info.h"
12
13 using WebKit::WebInputEvent;
14 using WebKit::WebTouchEvent;
15
16 namespace content {
17
18 namespace {
19
20 // How many milliseconds apart synthetic scroll messages should be sent.
21 const int kSyntheticGestureMessageIntervalMs = 7;
22
23 } // namespace
24
25 SyntheticGestureTargetBase::SyntheticGestureTargetBase(
26 RenderWidgetHostView* render_view)
27 : render_view_(render_view) {
28 }
29
30 void SyntheticGestureTargetBase::QueueInputEventToPlatform(
31 const InputEvent& event) {
32 const WebInputEvent* web_event = event.web_event.get();
33 if (WebInputEvent::isTouchEventType(web_event->type)) {
34 ScopedVector<ui::TouchEvent> events;
35
36 const WebTouchEvent* web_touch =
37 static_cast<const WebTouchEvent*>(web_event);
38
39 QueueWebTouchEventToPlatform(*web_touch, event.latency_info);
40 } else
41 NOTREACHED(); // FIXME: implement other types (MouseWheel?)
42 }
43
44 void SyntheticGestureTargetBase::OnSyntheticGestureCompleted(
45 SyntheticGestureNew::Result result) {
46 }
47
48 base::TimeDelta
49 SyntheticGestureTargetBase::GetSyntheticGestureUpdateRate() const {
50 return base::TimeDelta::FromMilliseconds(kSyntheticGestureMessageIntervalMs);
51 }
52
53 SyntheticGestureParams::GestureSourceType
54 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const {
55 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.
56 }
57
58 bool SyntheticGestureTargetBase::SupportsSyntheticGestureSourceType(
59 SyntheticGestureParams::GestureSourceType gesture_source_type) const {
60 // FIXME: add support for mouse
61 return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT;
62 }
63
64 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698