Index: ui/events/gestures/touch_point_state.h |
diff --git a/ui/events/gestures/touch_point_state.h b/ui/events/gestures/touch_point_state.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..76674b9ae9584b897dbce2c40e900d7e9805cdb4 |
--- /dev/null |
+++ b/ui/events/gestures/touch_point_state.h |
@@ -0,0 +1,74 @@ |
+// Copyright 2013 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 UI_EVENTS_GESTURES_TOUCH_POINT_STATE_H_ |
+#define UI_EVENTS_GESTURES_TOUCH_POINT_STATE_H_ |
+ |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/scoped_vector.h" |
+#include "ui/events/event.h" |
+ |
+namespace ui { |
+class TouchEvent; |
+ |
+class EVENTS_EXPORT TouchPointState { |
+ public: |
+ enum RequiresAck { |
+ WAIT_FOR_ACK = 0, |
+ NO_ACK |
+ }; |
+ |
+ TouchPointState(int touch_id); |
+ TouchPointState(int touch_id, |
+ bool has_press, |
+ bool has_release, |
+ int move_count, |
+ int timer_count); |
+ virtual ~TouchPointState(); |
+ void Update(const TouchEvent& event); |
+ void TimerFired(); |
+ void Reset(); |
+ |
+ // The caller is responsible for deleting the new |TouchPointState|. The new |
+ // |TouchPointState| will have timer_count_ set correctly, and will only |
+ // report events the associated gesture depends upon. See goo.gl/gZc70m for |
+ // details. |
+TouchPointState* CopyForGestureType( |
+ EventType type, RequiresAck requires_ack) const; |
+ |
+ bool HasEmptyIntersection(const TouchPointState& tps) const; |
+ bool Contains(const TouchPointState& tps) const; |
+ |
+ int touch_id() const {return touch_id_; } |
+ bool has_press() const { return has_press_; } |
+ bool has_release() const { return has_release_; } |
+ int move_count() const { return move_count_; } |
+ int timer_count() const { return timer_count_; } |
+ |
+ bool operator==(const TouchPointState& tps) const { |
+ return touch_id_ == tps.touch_id() && |
+ has_press() == tps.has_press() && |
+ has_release() == tps.has_release() && |
+ move_count() == tps.move_count() && |
+ timer_count() == tps.timer_count(); |
+ } |
+ |
+ private: |
+ TouchPointState(const TouchPointState& tps); |
+ TouchPointState Intersect(const TouchPointState& tps) const; |
+ |
+ int touch_id_; |
+ bool has_press_; |
+ bool has_release_; |
+ int move_count_; |
+ int timer_count_; |
+ |
+ DISALLOW_ASSIGN(TouchPointState); |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_EVENTS_GESTURES_TOUCH_POINT_STATE_H_ |