OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/basictypes.h" | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_WEB_H_ |
6 #include "base/time/time.h" | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_WEB_H_ |
| 7 |
| 8 #include "third_party/WebKit/public/web/WebInputEvent.h" |
7 #include "ui/events/gesture_detection/motion_event.h" | 9 #include "ui/events/gesture_detection/motion_event.h" |
8 #include "ui/gfx/geometry/point_f.h" | |
9 | 10 |
10 namespace ui { | 11 namespace content { |
11 | 12 |
12 struct MockMotionEvent : public MotionEvent { | 13 // Implementation of ui::MotionEvent wrapping a WebTouchEvent. |
13 MockMotionEvent(Action action, base::TimeTicks time, float x, float y); | 14 class MotionEventWeb : public ui::MotionEvent { |
14 MockMotionEvent(Action action, | 15 public: |
15 base::TimeTicks time, | 16 explicit MotionEventWeb(const blink::WebTouchEvent& event); |
16 float x0, | 17 virtual ~MotionEventWeb(); |
17 float y0, | |
18 float x1, | |
19 float y1); | |
20 MockMotionEvent(const MockMotionEvent& other); | |
21 virtual ~MockMotionEvent(); | |
22 | 18 |
| 19 // ui::MotionEvent |
23 virtual Action GetAction() const OVERRIDE; | 20 virtual Action GetAction() const OVERRIDE; |
24 virtual int GetActionIndex() const OVERRIDE; | 21 virtual int GetActionIndex() const OVERRIDE; |
25 virtual size_t GetPointerCount() const OVERRIDE; | 22 virtual size_t GetPointerCount() const OVERRIDE; |
26 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; | 23 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; |
27 virtual float GetX(size_t pointer_index) const OVERRIDE; | 24 virtual float GetX(size_t pointer_index) const OVERRIDE; |
28 virtual float GetY(size_t pointer_index) const OVERRIDE; | 25 virtual float GetY(size_t pointer_index) const OVERRIDE; |
29 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; | 26 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; |
30 virtual base::TimeTicks GetEventTime() const OVERRIDE; | 27 virtual base::TimeTicks GetEventTime() const OVERRIDE; |
31 virtual size_t GetHistorySize() const OVERRIDE; | 28 virtual size_t GetHistorySize() const OVERRIDE; |
32 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const | 29 virtual base::TimeTicks GetHistoricalEventTime( |
33 OVERRIDE; | 30 size_t historical_index) const OVERRIDE; |
34 virtual float GetHistoricalTouchMajor(size_t pointer_index, | 31 virtual float GetHistoricalTouchMajor( |
35 size_t historical_index) const OVERRIDE; | 32 size_t pointer_index, |
36 virtual float GetHistoricalX(size_t pointer_index, | 33 size_t historical_index) const OVERRIDE; |
37 size_t historical_index) const OVERRIDE; | 34 virtual float GetHistoricalX( |
38 virtual float GetHistoricalY(size_t pointer_index, | 35 size_t pointer_index, |
39 size_t historical_index) const OVERRIDE; | 36 size_t historical_index) const OVERRIDE; |
40 | 37 virtual float GetHistoricalY( |
| 38 size_t pointer_index, |
| 39 size_t historical_index) const OVERRIDE; |
41 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; | 40 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; |
42 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; | 41 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; |
43 | 42 |
44 MotionEvent::Action action; | 43 private: |
45 size_t pointer_count; | 44 blink::WebTouchEvent event_; |
46 gfx::PointF points[2]; | 45 Action cached_action_; |
47 base::TimeTicks time; | 46 int cached_action_index_; |
48 | 47 |
49 private: | 48 DISALLOW_COPY_AND_ASSIGN(MotionEventWeb); |
50 MockMotionEvent(); | |
51 }; | 49 }; |
52 | 50 |
53 } // namespace ui | 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOTION_EVENT_WEB_H_ |
OLD | NEW |