Index: content/browser/renderer_host/input/gestures/motion_event.h |
diff --git a/content/browser/renderer_host/input/gestures/motion_event.h b/content/browser/renderer_host/input/gestures/motion_event.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..73b4c999ca34d5399ecbf29598a0b864824ed00e |
--- /dev/null |
+++ b/content/browser/renderer_host/input/gestures/motion_event.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2014 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. |
+ |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_MOTION_EVENT_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_MOTION_EVENT_H_ |
+ |
+#include "base/time/time.h" |
+#include "third_party/WebKit/public/web/WebInputEvent.h" |
+ |
+namespace content { |
+ |
+// Utility wrapper class for Chromium input events, minimizing the required |
+// changes to the gesture detection classes forked from the Android framework. |
+class MotionEvent { |
+ public: |
+ enum Action { |
+ ACTION_POINTER_DOWN, |
+ ACTION_POINTER_UP, |
+ ACTION_DOWN, |
+ ACTION_UP, |
+ ACTION_CANCEL, |
+ ACTION_MOVE, |
+ ACTION_TYPE_COUNT |
+ }; |
+ |
+ explicit MotionEvent(const blink::WebTouchEvent& event); |
+ ~MotionEvent(); |
+ |
+ Action GetActionMasked() const; |
+ size_t GetActionIndex() const; |
+ size_t GetPointerCount() const; |
+ int GetPointerId(size_t pointer_index) const; |
+ float GetX() const { return GetX(0); } |
+ float GetY() const { return GetY(0); } |
+ float GetX(size_t pointer_index) const; |
+ float GetY(size_t pointer_index) const; |
+ float GetTouchMajor() const { return GetTouchMajor(0); } |
+ float GetTouchMajor(size_t pointer_index) const; |
+ base::TimeTicks GetEventTime() const; |
+ base::TimeTicks GetDownTime() const; |
+ |
+ size_t GetHistorySize() const; |
+ base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; |
+ float GetHistoricalTouchMajor(size_t pointer_index, |
+ size_t historical_index) const; |
+ float GetHistoricalX(size_t pointer_index, size_t historical_index) const; |
+ float GetHistoricalY(size_t pointer_index, size_t historical_index) const; |
+ |
+ // TODO(jdduke): Take a NativeWebTouchEvent that wraps either an Android |
+ // MotionEvent directly, or a ui::Event. |
+ blink::WebTouchEvent event; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(MotionEvent); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURES_MOTION_EVENT_H_ |