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

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

Issue 617423002: Make GestureTextSelector detect its own gestures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sort gyp/gn 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
« no previous file with comments | « ui/events/gesture_detection/gesture_detector.cc ('k') | ui/events/gesture_detection/gesture_listeners.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gesture_detection/gesture_listeners.h
diff --git a/ui/events/gesture_detection/gesture_listeners.h b/ui/events/gesture_detection/gesture_listeners.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d623476b765c57257cf9c0250b2876517bd21d9
--- /dev/null
+++ b/ui/events/gesture_detection/gesture_listeners.h
@@ -0,0 +1,83 @@
+// Copyright 2014 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_GESTURE_DETECTION_GESTURE_LISTENERS_H_
+#define UI_EVENTS_GESTURE_DETECTION_GESTURE_LISTENERS_H_
+
+#include "ui/events/gesture_detection/gesture_detection_export.h"
+
+namespace ui {
+
+class MotionEvent;
+
+// Client through which |GestureDetector| signals gesture detection.
+class GESTURE_DETECTION_EXPORT GestureListener {
+ public:
+ virtual ~GestureListener() {}
+ virtual bool OnDown(const MotionEvent& e) = 0;
+ virtual void OnShowPress(const MotionEvent& e) = 0;
+ virtual bool OnSingleTapUp(const MotionEvent& e) = 0;
+ virtual void OnLongPress(const MotionEvent& e) = 0;
+ virtual bool OnScroll(const MotionEvent& e1,
+ const MotionEvent& e2,
+ float distance_x,
+ float distance_y) = 0;
+ virtual bool OnFling(const MotionEvent& e1,
+ const MotionEvent& e2,
+ float velocity_x,
+ float velocity_y) = 0;
+ // Added for Chromium (Aura).
+ virtual bool OnSwipe(const MotionEvent& e1,
+ const MotionEvent& e2,
+ float velocity_x,
+ float velocity_y) = 0;
+ virtual bool OnTwoFingerTap(const MotionEvent& e1, const MotionEvent& e2) = 0;
+};
+
+// Client through which |GestureDetector| signals double-tap detection.
+class GESTURE_DETECTION_EXPORT DoubleTapListener {
+ public:
+ virtual ~DoubleTapListener() {}
+ virtual bool OnSingleTapConfirmed(const MotionEvent& e) = 0;
+ virtual bool OnDoubleTap(const MotionEvent& e) = 0;
+ virtual bool OnDoubleTapEvent(const MotionEvent& e) = 0;
+};
+
+// A convenience class to extend when you only want to listen for a subset
+// of all the gestures. This implements all methods in the
+// |GestureListener| and |DoubleTapListener| but does
+// nothing and returns false for all applicable methods.
+class GESTURE_DETECTION_EXPORT SimpleGestureListener
+ : public GestureListener,
+ public DoubleTapListener {
+ public:
+ // GestureListener implementation.
+ virtual bool OnDown(const MotionEvent& e) override;
+ virtual void OnShowPress(const MotionEvent& e) override;
+ virtual bool OnSingleTapUp(const MotionEvent& e) override;
+ virtual void OnLongPress(const MotionEvent& e) override;
+ virtual bool OnScroll(const MotionEvent& e1,
+ const MotionEvent& e2,
+ float distance_x,
+ float distance_y) override;
+ virtual bool OnFling(const MotionEvent& e1,
+ const MotionEvent& e2,
+ float velocity_x,
+ float velocity_y) override;
+ virtual bool OnSwipe(const MotionEvent& e1,
+ const MotionEvent& e2,
+ float velocity_x,
+ float velocity_y) override;
+ virtual bool OnTwoFingerTap(const MotionEvent& e1,
+ const MotionEvent& e2) override;
+
+ // DoubleTapListener implementation.
+ virtual bool OnSingleTapConfirmed(const MotionEvent& e) override;
+ virtual bool OnDoubleTap(const MotionEvent& e) override;
+ virtual bool OnDoubleTapEvent(const MotionEvent& e) override;
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_LISTENERS_H_
« no previous file with comments | « ui/events/gesture_detection/gesture_detector.cc ('k') | ui/events/gesture_detection/gesture_listeners.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698