Index: content/browser/renderer_host/input/gesture_text_selector.h |
diff --git a/content/browser/renderer_host/input/gesture_text_selector.h b/content/browser/renderer_host/input/gesture_text_selector.h |
index 092c30dab1238067e4ede48d5520aa46a36bfe86..b57d8976b19741a96788b8db4aaed263d069d58e 100644 |
--- a/content/browser/renderer_host/input/gesture_text_selector.h |
+++ b/content/browser/renderer_host/input/gesture_text_selector.h |
@@ -7,11 +7,14 @@ |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/time/time.h" |
#include "content/common/content_export.h" |
Changwan Ryu
2014/10/02 00:39:53
You don't need a blank line here.
jdduke (slow)
2014/10/02 19:30:23
Done.
|
+#include "ui/events/gesture_detection/gesture_listeners.h" |
+ |
namespace ui { |
-struct GestureEventData; |
+class GestureDetector; |
class MotionEvent; |
} |
@@ -26,36 +29,38 @@ class CONTENT_EXPORT GestureTextSelectorClient { |
virtual void ShowSelectionHandlesAutomatically() = 0; |
virtual void SelectRange(float x1, float y1, float x2, float y2) = 0; |
- virtual void Unselect() = 0; |
virtual void LongPress(base::TimeTicks time, float x, float y) = 0; |
}; |
// A class to handle gesture-based text selection, such as when clicking first |
// button on stylus input. It also generates a synthetic long press gesture on |
// tap so that a word can be selected or the contextual menu can be shown. |
-class CONTENT_EXPORT GestureTextSelector { |
+class CONTENT_EXPORT GestureTextSelector : public ui::SimpleGestureListener { |
public: |
explicit GestureTextSelector(GestureTextSelectorClient* client); |
virtual ~GestureTextSelector(); |
- // This should be called after gesture detection but before associated |
- // gestures are dispatched. Returns whether it will consume |event|. |
+ // This should be called before |event| is seen by the platform gesture |
+ // detector or forwarded to web content. |
bool OnTouchEvent(const ui::MotionEvent& event); |
- // Returns whether it will consume the event. |
- bool OnGestureEvent(const ui::GestureEventData& gesture); |
- |
private: |
friend class GestureTextSelectorTest; |
FRIEND_TEST_ALL_PREFIXES(GestureTextSelectorTest, |
ShouldStartTextSelection); |
+ // SimpleGestureListener implementation. |
+ virtual bool OnSingleTapUp(const ui::MotionEvent& e) override; |
+ virtual bool OnScroll(const ui::MotionEvent& e1, |
+ const ui::MotionEvent& e2, |
+ float distance_x, |
+ float distance_y) override; |
+ |
static bool ShouldStartTextSelection(const ui::MotionEvent& event); |
GestureTextSelectorClient* client_; |
bool text_selection_triggered_; |
- float anchor_x_; |
- float anchor_y_; |
+ scoped_ptr<ui::GestureDetector> gesture_detector_; |
DISALLOW_COPY_AND_ASSIGN(GestureTextSelector); |
}; |