| 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_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
| 13 #include "ui/events/events_export.h" | 13 #include "ui/events/events_export.h" |
| 14 #include "ui/events/gesture_detection/motion_event_generic.h" | 14 #include "ui/events/gesture_detection/motion_event_generic.h" |
| 15 | 15 |
| 16 namespace ui { | 16 namespace ui { |
| 17 | 17 |
| 18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents. | 18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents. |
| 19 class EVENTS_EXPORT MotionEventAura : public MotionEventGeneric { | 19 class EVENTS_EXPORT MotionEventAura : public MotionEventGeneric { |
| 20 public: | 20 public: |
| 21 MotionEventAura(); | 21 MotionEventAura(); |
| 22 ~MotionEventAura() override; | 22 ~MotionEventAura() override; |
| 23 | 23 |
| 24 // MotionEventGeneric: | 24 // MotionEventGeneric: |
| 25 int GetId() const override; | |
| 26 int GetSourceDeviceId(size_t pointer_index) const override; | 25 int GetSourceDeviceId(size_t pointer_index) const override; |
| 27 | 26 |
| 28 // Returns true iff the touch was valid. | 27 // Returns true iff the touch was valid. |
| 29 bool OnTouch(const TouchEvent& touch); | 28 bool OnTouch(const TouchEvent& touch); |
| 30 | 29 |
| 31 // We can't cleanup removed touch points immediately upon receipt of a | 30 // We can't cleanup removed touch points immediately upon receipt of a |
| 32 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report | 31 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report |
| 33 // information about those touch events. Once the MotionEvent has been | 32 // information about those touch events. Once the MotionEvent has been |
| 34 // processed, we call CleanupRemovedTouchPoints to do the required | 33 // processed, we call CleanupRemovedTouchPoints to do the required |
| 35 // book-keeping. | 34 // book-keeping. |
| 36 void CleanupRemovedTouchPoints(const TouchEvent& event); | 35 void CleanupRemovedTouchPoints(const TouchEvent& event); |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 void AddTouch(const TouchEvent& touch); | 38 void AddTouch(const TouchEvent& touch); |
| 40 void UpdateTouch(const TouchEvent& touch); | 39 void UpdateTouch(const TouchEvent& touch); |
| 41 void UpdateCachedAction(const TouchEvent& touch); | 40 void UpdateCachedAction(const TouchEvent& touch); |
| 42 int GetIndexFromId(int id) const; | 41 int GetIndexFromId(int id) const; |
| 43 | 42 |
| 44 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); | 43 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); |
| 45 }; | 44 }; |
| 46 | 45 |
| 47 } // namespace ui | 46 } // namespace ui |
| 48 | 47 |
| 49 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 48 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| OLD | NEW |