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_MOTION_EVENT_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
6 #define UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include <memory> |
| 12 |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 #include "ui/events/gesture_detection/gesture_detection_export.h" | 14 #include "ui/events/gesture_detection/gesture_detection_export.h" |
14 | 15 |
15 namespace ui { | 16 namespace ui { |
16 | 17 |
17 // Abstract class for a generic motion-related event, patterned after that | 18 // Abstract class for a generic motion-related event, patterned after that |
18 // subset of Android's MotionEvent API used in gesture detection. | 19 // subset of Android's MotionEvent API used in gesture detection. |
19 class GESTURE_DETECTION_EXPORT MotionEvent { | 20 class GESTURE_DETECTION_EXPORT MotionEvent { |
20 public: | 21 public: |
21 enum Action { | 22 enum Action { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 float GetTilt() const { return GetTilt(0); } | 111 float GetTilt() const { return GetTilt(0); } |
111 ToolType GetToolType() const { return GetToolType(0); } | 112 ToolType GetToolType() const { return GetToolType(0); } |
112 | 113 |
113 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. | 114 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. |
114 int FindPointerIndexOfId(int id) const; | 115 int FindPointerIndexOfId(int id) const; |
115 | 116 |
116 // Note that these methods perform shallow copies of the originating events. | 117 // Note that these methods perform shallow copies of the originating events. |
117 // They guarantee only that the returned type will reflect the same | 118 // They guarantee only that the returned type will reflect the same |
118 // data exposed by the MotionEvent interface; no guarantees are made that the | 119 // data exposed by the MotionEvent interface; no guarantees are made that the |
119 // underlying implementation is identical to the source implementation. | 120 // underlying implementation is identical to the source implementation. |
120 scoped_ptr<MotionEvent> Clone() const; | 121 std::unique_ptr<MotionEvent> Clone() const; |
121 scoped_ptr<MotionEvent> Cancel() const; | 122 std::unique_ptr<MotionEvent> Cancel() const; |
122 }; | 123 }; |
123 | 124 |
124 } // namespace ui | 125 } // namespace ui |
125 | 126 |
126 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 127 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
OLD | NEW |