Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1047)

Unified Diff: ui/events/gesture_detection/motion_event.h

Issue 502993004: Remove abstract Clone and Cancel methods from MotionEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/gesture_detection/motion_event.h
diff --git a/ui/events/gesture_detection/motion_event.h b/ui/events/gesture_detection/motion_event.h
index 2277277aa91812ddb57c0767159817f6541fc07a..e2fdf2c06089898785a9bfe296859662ca3fb10f 100644
--- a/ui/events/gesture_detection/motion_event.h
+++ b/ui/events/gesture_detection/motion_event.h
@@ -5,6 +5,8 @@
#ifndef UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_
#define UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_
+#include <string>
+
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "ui/events/gesture_detection/gesture_detection_export.h"
@@ -76,9 +78,7 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
virtual float GetHistoricalY(size_t pointer_index,
size_t historical_index) const;
- virtual scoped_ptr<MotionEvent> Clone() const = 0;
- virtual scoped_ptr<MotionEvent> Cancel() const = 0;
-
+ // Utility accessor methods for convenience.
float GetX() const { return GetX(0); }
float GetY() const { return GetY(0); }
float GetRawX() const { return GetRawX(0); }
@@ -98,12 +98,18 @@ class GESTURE_DETECTION_EXPORT MotionEvent {
// O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent.
int FindPointerIndexOfId(int id) const;
-};
-GESTURE_DETECTION_EXPORT bool operator==(const MotionEvent& lhs,
- const MotionEvent& rhs);
-GESTURE_DETECTION_EXPORT bool operator!=(const MotionEvent& lhs,
- const MotionEvent& rhs);
+ // Note that these methods perform shallow copies of the originating events.
+ // They guarantee only that the returned type will reflect the same
+ // data exposed by the MotionEvent interface; no guarantees are made that the
+ // underlying implementation is identical to the source implementation.
+ scoped_ptr<MotionEvent> Clone() const;
+ scoped_ptr<MotionEvent> Cancel() const;
+
+ // Note: This routine is not at all optimized and should not be used outside
+ // of testing in any production code.
+ std::string ToString() const;
+};
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698