| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ | 5 #ifndef UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ |
| 6 #define UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ | 6 #define UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 virtual void SetAlpha(float alpha) = 0; | 34 virtual void SetAlpha(float alpha) = 0; |
| 35 virtual void SetFocus(const gfx::PointF& position) = 0; | 35 virtual void SetFocus(const gfx::PointF& position) = 0; |
| 36 virtual gfx::RectF GetVisibleBounds() const = 0; | 36 virtual gfx::RectF GetVisibleBounds() const = 0; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // Interface through which |TouchHandle| communicates handle manipulation and | 39 // Interface through which |TouchHandle| communicates handle manipulation and |
| 40 // requests concrete drawable instances. | 40 // requests concrete drawable instances. |
| 41 class UI_TOUCH_SELECTION_EXPORT TouchHandleClient { | 41 class UI_TOUCH_SELECTION_EXPORT TouchHandleClient { |
| 42 public: | 42 public: |
| 43 virtual ~TouchHandleClient() {} | 43 virtual ~TouchHandleClient() {} |
| 44 virtual void OnHandleDragBegin(const TouchHandle& handle) = 0; | 44 virtual void OnHandleDragBegin(const TouchHandle& handle, |
| 45 base::TimeTicks event_time) = 0; |
| 45 virtual void OnHandleDragUpdate(const TouchHandle& handle, | 46 virtual void OnHandleDragUpdate(const TouchHandle& handle, |
| 46 const gfx::PointF& new_position) = 0; | 47 const gfx::PointF& new_position, |
| 48 base::TimeTicks event_time) = 0; |
| 47 virtual void OnHandleDragEnd(const TouchHandle& handle) = 0; | 49 virtual void OnHandleDragEnd(const TouchHandle& handle) = 0; |
| 48 virtual void OnHandleTapped(const TouchHandle& handle) = 0; | 50 virtual void OnHandleTapped(const TouchHandle& handle) = 0; |
| 49 virtual void SetNeedsAnimate() = 0; | 51 virtual void SetNeedsAnimate() = 0; |
| 50 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() = 0; | 52 virtual scoped_ptr<TouchHandleDrawable> CreateDrawable() = 0; |
| 51 virtual base::TimeDelta GetTapTimeout() const = 0; | 53 virtual base::TimeDelta GetTapTimeout() const = 0; |
| 52 virtual float GetTapSlop() const = 0; | 54 virtual float GetTapSlop() const = 0; |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 // Responsible for displaying a selection or insertion handle for text | 57 // Responsible for displaying a selection or insertion handle for text |
| 56 // interaction. | 58 // interaction. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Returns true if an animation is active and requires further ticking. | 92 // Returns true if an animation is active and requires further ticking. |
| 91 bool Animate(base::TimeTicks frame_time); | 93 bool Animate(base::TimeTicks frame_time); |
| 92 | 94 |
| 93 bool is_dragging() const { return is_dragging_; } | 95 bool is_dragging() const { return is_dragging_; } |
| 94 const gfx::PointF& position() const { return position_; } | 96 const gfx::PointF& position() const { return position_; } |
| 95 TouchHandleOrientation orientation() const { return orientation_; } | 97 TouchHandleOrientation orientation() const { return orientation_; } |
| 96 | 98 |
| 97 private: | 99 private: |
| 98 friend class TouchSelectionControllerAuraTest; | 100 friend class TouchSelectionControllerAuraTest; |
| 99 | 101 |
| 100 void BeginDrag(); | 102 void BeginDrag(base::TimeTicks event_time); |
| 101 void EndDrag(); | 103 void EndDrag(); |
| 102 void BeginFade(); | 104 void BeginFade(); |
| 103 void EndFade(); | 105 void EndFade(); |
| 104 void SetAlpha(float alpha); | 106 void SetAlpha(float alpha); |
| 105 | 107 |
| 106 TouchHandleDrawable* drawable_for_testing() const { return drawable_.get(); } | 108 TouchHandleDrawable* drawable_for_testing() const { return drawable_.get(); } |
| 107 | 109 |
| 108 scoped_ptr<TouchHandleDrawable> drawable_; | 110 scoped_ptr<TouchHandleDrawable> drawable_; |
| 109 | 111 |
| 110 TouchHandleClient* const client_; | 112 TouchHandleClient* const client_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 129 bool is_visible_; | 131 bool is_visible_; |
| 130 bool is_dragging_; | 132 bool is_dragging_; |
| 131 bool is_drag_within_tap_region_; | 133 bool is_drag_within_tap_region_; |
| 132 | 134 |
| 133 DISALLOW_COPY_AND_ASSIGN(TouchHandle); | 135 DISALLOW_COPY_AND_ASSIGN(TouchHandle); |
| 134 }; | 136 }; |
| 135 | 137 |
| 136 } // namespace ui | 138 } // namespace ui |
| 137 | 139 |
| 138 #endif // UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ | 140 #endif // UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ |
| OLD | NEW |