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