| 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 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/containers/stack_container.h" | 9 #include "base/containers/stack_container.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 class GESTURE_DETECTION_EXPORT MotionEventGeneric : public MotionEvent { | 36 class GESTURE_DETECTION_EXPORT MotionEventGeneric : public MotionEvent { |
| 37 public: | 37 public: |
| 38 MotionEventGeneric(Action action, | 38 MotionEventGeneric(Action action, |
| 39 base::TimeTicks event_time, | 39 base::TimeTicks event_time, |
| 40 const PointerProperties& pointer); | 40 const PointerProperties& pointer); |
| 41 MotionEventGeneric(const MotionEventGeneric& other); | 41 MotionEventGeneric(const MotionEventGeneric& other); |
| 42 | 42 |
| 43 ~MotionEventGeneric() override; | 43 ~MotionEventGeneric() override; |
| 44 | 44 |
| 45 // MotionEvent implementation. | 45 // MotionEvent implementation. |
| 46 int GetId() const override; | 46 uint64 GetUniqueEventId() const override; |
| 47 Action GetAction() const override; | 47 Action GetAction() const override; |
| 48 int GetActionIndex() const override; | 48 int GetActionIndex() const override; |
| 49 size_t GetPointerCount() const override; | 49 size_t GetPointerCount() const override; |
| 50 int GetPointerId(size_t pointer_index) const override; | 50 int GetPointerId(size_t pointer_index) const override; |
| 51 float GetX(size_t pointer_index) const override; | 51 float GetX(size_t pointer_index) const override; |
| 52 float GetY(size_t pointer_index) const override; | 52 float GetY(size_t pointer_index) const override; |
| 53 float GetRawX(size_t pointer_index) const override; | 53 float GetRawX(size_t pointer_index) const override; |
| 54 float GetRawY(size_t pointer_index) const override; | 54 float GetRawY(size_t pointer_index) const override; |
| 55 float GetTouchMajor(size_t pointer_index) const override; | 55 float GetTouchMajor(size_t pointer_index) const override; |
| 56 float GetTouchMinor(size_t pointer_index) const override; | 56 float GetTouchMinor(size_t pointer_index) const override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 80 const PointerProperties& pointer(size_t index) const { | 80 const PointerProperties& pointer(size_t index) const { |
| 81 return pointers_[index]; | 81 return pointers_[index]; |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Add an event to the history. |this| and |event| must have the same pointer | 84 // Add an event to the history. |this| and |event| must have the same pointer |
| 85 // count and must both have an action of ACTION_MOVE. | 85 // count and must both have an action of ACTION_MOVE. |
| 86 void PushHistoricalEvent(scoped_ptr<MotionEvent> event); | 86 void PushHistoricalEvent(scoped_ptr<MotionEvent> event); |
| 87 | 87 |
| 88 void set_action(Action action) { action_ = action; } | 88 void set_action(Action action) { action_ = action; } |
| 89 void set_event_time(base::TimeTicks event_time) { event_time_ = event_time; } | 89 void set_event_time(base::TimeTicks event_time) { event_time_ = event_time; } |
| 90 void set_id(int id) { id_ = id; } | 90 void set_unique_event_id(uint64 unique_event_id) { |
| 91 unique_event_id_ = unique_event_id; |
| 92 } |
| 91 void set_action_index(int action_index) { action_index_ = action_index; } | 93 void set_action_index(int action_index) { action_index_ = action_index; } |
| 92 void set_button_state(int button_state) { button_state_ = button_state; } | 94 void set_button_state(int button_state) { button_state_ = button_state; } |
| 93 void set_flags(int flags) { flags_ = flags; } | 95 void set_flags(int flags) { flags_ = flags; } |
| 94 | 96 |
| 95 static scoped_ptr<MotionEventGeneric> CloneEvent(const MotionEvent& event); | 97 static scoped_ptr<MotionEventGeneric> CloneEvent(const MotionEvent& event); |
| 96 static scoped_ptr<MotionEventGeneric> CancelEvent(const MotionEvent& event); | 98 static scoped_ptr<MotionEventGeneric> CancelEvent(const MotionEvent& event); |
| 97 | 99 |
| 98 protected: | 100 protected: |
| 99 MotionEventGeneric(); | 101 MotionEventGeneric(); |
| 100 MotionEventGeneric(const MotionEvent& event, bool with_history); | 102 MotionEventGeneric(const MotionEvent& event, bool with_history); |
| 101 MotionEventGeneric& operator=(const MotionEventGeneric& other); | 103 MotionEventGeneric& operator=(const MotionEventGeneric& other); |
| 102 | 104 |
| 103 void PopPointer(); | 105 void PopPointer(); |
| 104 | 106 |
| 105 private: | 107 private: |
| 106 enum { kTypicalMaxPointerCount = 5 }; | 108 enum { kTypicalMaxPointerCount = 5 }; |
| 107 | 109 |
| 108 Action action_; | 110 Action action_; |
| 109 base::TimeTicks event_time_; | 111 base::TimeTicks event_time_; |
| 110 int id_; | 112 uint64 unique_event_id_; |
| 111 int action_index_; | 113 int action_index_; |
| 112 int button_state_; | 114 int button_state_; |
| 113 int flags_; | 115 int flags_; |
| 114 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_; | 116 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_; |
| 115 ScopedVector<MotionEvent> historical_events_; | 117 ScopedVector<MotionEvent> historical_events_; |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 } // namespace ui | 120 } // namespace ui |
| 119 | 121 |
| 120 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ | 122 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ |
| OLD | NEW |