Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_TEXT_SELECTOR_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_TEXT_SELECTOR_H_ | |
| 7 | |
| 8 #include "base/gtest_prod_util.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
|
jdduke (slow)
2014/06/25 14:54:19
Don't think we need scoped_ptr.h anymore.
Changwan Ryu
2014/06/26 00:05:27
Removed.
| |
| 11 #include "content/common/content_export.h" | |
| 12 | |
| 13 namespace ui { | |
| 14 struct GestureEventData; | |
| 15 class MotionEvent; | |
| 16 } | |
| 17 | |
| 18 namespace content { | |
| 19 class GestureTextSelectorTest; | |
| 20 | |
| 21 // Interface with which GestureTextSelector can select, unselect, or show | |
| 22 // selection handles. | |
| 23 class CONTENT_EXPORT GestureTextSelectorClient { | |
| 24 public: | |
| 25 virtual ~GestureTextSelectorClient() {} | |
| 26 | |
| 27 virtual void ShowSelectionHandlesAutomatically() = 0; | |
| 28 virtual void SelectRange(float x1, float y1, float x2, float y2) = 0; | |
| 29 virtual void Unselect() = 0; | |
| 30 }; | |
| 31 | |
| 32 // A class to handle gesture-based text selection, such as when clicking first | |
| 33 // button on stylus input. | |
| 34 class CONTENT_EXPORT GestureTextSelector { | |
| 35 public: | |
| 36 explicit GestureTextSelector(GestureTextSelectorClient* client); | |
| 37 virtual ~GestureTextSelector(); | |
| 38 | |
| 39 // This should be called after gesture detection but before associated | |
| 40 // gestures are dispatched. Returns whether it will consume |event|. | |
| 41 bool OnTouchEvent(const ui::MotionEvent& event); | |
| 42 // Returns whether it will consume the event. | |
|
jdduke (slow)
2014/06/25 14:54:19
Nit: Let's add a line break between the two method
Changwan Ryu
2014/06/26 00:05:27
Done.
| |
| 43 bool OnGestureEvent(const ui::GestureEventData& gesture); | |
| 44 | |
| 45 private: | |
| 46 friend class GestureTextSelectorTest; | |
| 47 FRIEND_TEST_ALL_PREFIXES(GestureTextSelectorTest, | |
| 48 ShouldStartTextSelection); | |
| 49 | |
| 50 static bool ShouldStartTextSelection(const ui::MotionEvent& event); | |
| 51 | |
| 52 GestureTextSelectorClient* client_; | |
| 53 bool text_selection_triggered_; | |
| 54 float anchor_x_; | |
| 55 float anchor_y_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(GestureTextSelector); | |
| 58 }; | |
| 59 | |
| 60 } // namespace content | |
| 61 | |
| 62 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_GESTURE_TEXT_SELECTOR_H_ | |
| OLD | NEW |