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

Side by Side Diff: content/browser/renderer_host/input/gestures/motion_event.h

Issue 128613003: [Tracking Patch] Unified gesture detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months 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 2014 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_MOTION_EVENT_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_MOTION_EVENT_H_
7
8 #include "base/time/time.h"
9 #include "third_party/WebKit/public/web/WebInputEvent.h"
10
11 namespace content {
12
13 // Utility wrapper class for Chromium input events, minimizing the required
14 // changes to the gesture detection classes forked from the Android framework.
15 class MotionEvent {
16 public:
17 enum Action {
18 ACTION_POINTER_DOWN,
19 ACTION_POINTER_UP,
20 ACTION_DOWN,
21 ACTION_UP,
22 ACTION_CANCEL,
23 ACTION_MOVE,
24 ACTION_TYPE_COUNT
25 };
26
27 explicit MotionEvent(const blink::WebTouchEvent& event);
28 ~MotionEvent();
29
30 Action GetActionMasked() const;
31 size_t GetActionIndex() const;
32 size_t GetPointerCount() const;
33 int GetPointerId(size_t pointer_index) const;
34 float GetX() const { return GetX(0); }
35 float GetY() const { return GetY(0); }
36 float GetX(size_t pointer_index) const;
37 float GetY(size_t pointer_index) const;
38 float GetTouchMajor() const { return GetTouchMajor(0); }
39 float GetTouchMajor(size_t pointer_index) const;
40 base::TimeTicks GetEventTime() const;
41 base::TimeTicks GetDownTime() const;
42
43 size_t GetHistorySize() const;
44 base::TimeTicks GetHistoricalEventTime(size_t historical_index) const;
45 float GetHistoricalTouchMajor(size_t pointer_index,
46 size_t historical_index) const;
47 float GetHistoricalX(size_t pointer_index, size_t historical_index) const;
48 float GetHistoricalY(size_t pointer_index, size_t historical_index) const;
49
50 // TODO(jdduke): Take a NativeWebTouchEvent that wraps either an Android
51 // MotionEvent directly, or a ui::Event.
52 blink::WebTouchEvent event;
53
54 private:
55 DISALLOW_COPY_AND_ASSIGN(MotionEvent);
56 };
57
58 } // namespace content
59
60 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_MOTION_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698