Index: content/browser/renderer_host/input/motion_event_web.h |
diff --git a/ui/events/gesture_detection/mock_motion_event.h b/content/browser/renderer_host/input/motion_event_web.h |
similarity index 43% |
copy from ui/events/gesture_detection/mock_motion_event.h |
copy to content/browser/renderer_host/input/motion_event_web.h |
index 27da9326470f4bfd7aebf83d2567963af3e1da14..011d713af2fc9f5cc4c5ee1cf5e2ff4ff2ada043 100644 |
--- a/ui/events/gesture_detection/mock_motion_event.h |
+++ b/content/browser/renderer_host/input/motion_event_web.h |
@@ -2,24 +2,21 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "base/basictypes.h" |
-#include "base/time/time.h" |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_WEB_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_WEB_H_ |
+ |
+#include "third_party/WebKit/public/web/WebInputEvent.h" |
#include "ui/events/gesture_detection/motion_event.h" |
-#include "ui/gfx/geometry/point_f.h" |
-namespace ui { |
+namespace content { |
-struct MockMotionEvent : public MotionEvent { |
- MockMotionEvent(Action action, base::TimeTicks time, float x, float y); |
- MockMotionEvent(Action action, |
- base::TimeTicks time, |
- float x0, |
- float y0, |
- float x1, |
- float y1); |
- MockMotionEvent(const MockMotionEvent& other); |
- virtual ~MockMotionEvent(); |
+// Implementation of ui::MotionEvent wrapping a WebTouchEvent. |
+class MotionEventWeb : public ui::MotionEvent { |
+ public: |
+ explicit MotionEventWeb(const blink::WebTouchEvent& event); |
+ virtual ~MotionEventWeb(); |
+ // ui::MotionEvent |
virtual Action GetAction() const OVERRIDE; |
virtual int GetActionIndex() const OVERRIDE; |
virtual size_t GetPointerCount() const OVERRIDE; |
@@ -29,25 +26,28 @@ struct MockMotionEvent : public MotionEvent { |
virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; |
virtual base::TimeTicks GetEventTime() const OVERRIDE; |
virtual size_t GetHistorySize() const OVERRIDE; |
- virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const |
- OVERRIDE; |
- virtual float GetHistoricalTouchMajor(size_t pointer_index, |
- size_t historical_index) const OVERRIDE; |
- virtual float GetHistoricalX(size_t pointer_index, |
- size_t historical_index) const OVERRIDE; |
- virtual float GetHistoricalY(size_t pointer_index, |
- size_t historical_index) const OVERRIDE; |
- |
+ virtual base::TimeTicks GetHistoricalEventTime( |
+ size_t historical_index) const OVERRIDE; |
+ virtual float GetHistoricalTouchMajor( |
+ size_t pointer_index, |
+ size_t historical_index) const OVERRIDE; |
+ virtual float GetHistoricalX( |
+ size_t pointer_index, |
+ size_t historical_index) const OVERRIDE; |
+ virtual float GetHistoricalY( |
+ size_t pointer_index, |
+ size_t historical_index) const OVERRIDE; |
virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; |
virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; |
- MotionEvent::Action action; |
- size_t pointer_count; |
- gfx::PointF points[2]; |
- base::TimeTicks time; |
- |
private: |
- MockMotionEvent(); |
+ blink::WebTouchEvent event_; |
+ Action cached_action_; |
+ int cached_action_index_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MotionEventWeb); |
}; |
-} // namespace ui |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_WEB_H_ |