Index: ui/events/gesture_detection/scale_gesture_detector.h |
diff --git a/ui/events/gesture_detection/scale_gesture_detector.h b/ui/events/gesture_detection/scale_gesture_detector.h |
index 7f647c0684cceae31232928ab811f0003d7a87a5..9b1c9a8927af527ef1f43ff1f01e952369e21c4f 100644 |
--- a/ui/events/gesture_detection/scale_gesture_detector.h |
+++ b/ui/events/gesture_detection/scale_gesture_detector.h |
@@ -5,10 +5,8 @@ |
#ifndef UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_DETECTOR_H_ |
#define UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_DETECTOR_H_ |
-#include "base/memory/scoped_ptr.h" |
#include "base/time/time.h" |
#include "ui/events/gesture_detection/gesture_detection_export.h" |
-#include "ui/events/gesture_detection/gesture_detector.h" |
namespace ui { |
@@ -18,12 +16,16 @@ class MotionEvent; |
// * platform/frameworks/base/core/java/android/view/ScaleGestureDetector.java |
// * Change-Id: I3e7926a4f6f9ab4951f380bd004499c78b3bda69 |
// * Please update the Change-Id as upstream Android changes are pulled. |
-class ScaleGestureDetector : public GestureDetector::SimpleGestureListener { |
+class ScaleGestureDetector { |
public: |
struct GESTURE_DETECTION_EXPORT Config { |
Config(); |
~Config(); |
- GestureDetector::Config gesture_detector_config; |
+ |
+ // Distance the current span can deviate from the initial span before |
+ // scaling will start (in dips). The span is the diameter of the circle with |
+ // a radius of average pointer deviation from the focal point. |
+ float span_slop; |
// Minimum accepted value for TouchMajor while scaling (in dips). |
float min_scaling_touch_major; |
@@ -31,9 +33,6 @@ class ScaleGestureDetector : public GestureDetector::SimpleGestureListener { |
// Minimum span needed to initiate a scaling gesture (in dips). |
float min_scaling_span; |
- // Whether double-tap drag scaling is enabled. |
- bool quick_scale_enabled; |
- |
// Minimum pinch span change before pinch occurs (in dips). See |
// crbug.com/373318. |
float min_pinch_update_span_delta; |
@@ -82,10 +81,14 @@ class ScaleGestureDetector : public GestureDetector::SimpleGestureListener { |
// the rest of the MotionEvents in this event stream. |
bool OnTouchEvent(const MotionEvent& event); |
+ // This method may be called by the owner when a a double-tap event has been |
+ // detected *for the same event stream* being fed to this instance of the |
+ // ScaleGestureDetector. As call order is important here, the double-tap |
+ // detector should always be offered events *before* the ScaleGestureDetector. |
+ bool OnDoubleTap(const MotionEvent& event); |
+ |
// Set whether the associated |ScaleGestureListener| should receive |
// OnScale callbacks when the user performs a doubletap followed by a swipe. |
- void SetQuickScaleEnabled(bool scales); |
- bool IsQuickScaleEnabled() const; |
bool IsInProgress() const; |
bool InDoubleTapMode() const; |
float GetFocusX() const; |
@@ -103,9 +106,6 @@ class ScaleGestureDetector : public GestureDetector::SimpleGestureListener { |
private: |
enum DoubleTapMode { DOUBLE_TAP_MODE_NONE, DOUBLE_TAP_MODE_IN_PROGRESS }; |
- // DoubleTapListener implementation. |
- virtual bool OnDoubleTap(const MotionEvent& ev) OVERRIDE; |
- |
// The TouchMajor/TouchMinor elements of a MotionEvent can flutter/jitter on |
// some hardware/driver combos. Smooth out to get kinder, gentler behavior. |
void AddTouchHistory(const MotionEvent& ev); |
@@ -115,13 +115,8 @@ class ScaleGestureDetector : public GestureDetector::SimpleGestureListener { |
ScaleGestureListener* const listener_; |
- Config config_; |
- |
float focus_x_; |
float focus_y_; |
- |
- bool quick_scale_enabled_; |
- |
float curr_span_; |
float prev_span_; |
float initial_span_; |
@@ -149,8 +144,6 @@ class ScaleGestureDetector : public GestureDetector::SimpleGestureListener { |
bool event_before_or_above_starting_gesture_event_; |
- scoped_ptr<GestureDetector> gesture_detector_; |
- |
DISALLOW_COPY_AND_ASSIGN(ScaleGestureDetector); |
}; |