OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 void OverscrollCompleted(); | 42 void OverscrollCompleted(); |
43 | 43 |
44 // Overridden from RenderWidgetHostViewAura::TouchEditingClient. | 44 // Overridden from RenderWidgetHostViewAura::TouchEditingClient. |
45 virtual void StartTouchEditing() OVERRIDE; | 45 virtual void StartTouchEditing() OVERRIDE; |
46 virtual void EndTouchEditing(bool quick) OVERRIDE; | 46 virtual void EndTouchEditing(bool quick) OVERRIDE; |
47 virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor, | 47 virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor, |
48 const gfx::Rect& focus) OVERRIDE; | 48 const gfx::Rect& focus) OVERRIDE; |
49 virtual void OnTextInputTypeChanged(ui::TextInputType type) OVERRIDE; | 49 virtual void OnTextInputTypeChanged(ui::TextInputType type) OVERRIDE; |
50 virtual bool HandleInputEvent(const ui::Event* event) OVERRIDE; | 50 virtual bool HandleInputEvent(const ui::Event* event) OVERRIDE; |
51 virtual void GestureEventAck(int gesture_event_type) OVERRIDE; | 51 virtual void GestureEventAck(int gesture_event_type) OVERRIDE; |
| 52 virtual void DidStopFlinging() OVERRIDE; |
52 virtual void OnViewDestroyed() OVERRIDE; | 53 virtual void OnViewDestroyed() OVERRIDE; |
53 | 54 |
54 // Overridden from ui::TouchEditable: | 55 // Overridden from ui::TouchEditable: |
55 virtual void SelectRect(const gfx::Point& start, | 56 virtual void SelectRect(const gfx::Point& start, |
56 const gfx::Point& end) OVERRIDE; | 57 const gfx::Point& end) OVERRIDE; |
57 virtual void MoveCaretTo(const gfx::Point& point) OVERRIDE; | 58 virtual void MoveCaretTo(const gfx::Point& point) OVERRIDE; |
58 virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) OVERRIDE; | 59 virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) OVERRIDE; |
59 virtual gfx::Rect GetBounds() OVERRIDE; | 60 virtual gfx::Rect GetBounds() OVERRIDE; |
60 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 61 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
61 virtual void ConvertPointToScreen(gfx::Point* point) OVERRIDE; | 62 virtual void ConvertPointToScreen(gfx::Point* point) OVERRIDE; |
62 virtual void ConvertPointFromScreen(gfx::Point* point) OVERRIDE; | 63 virtual void ConvertPointFromScreen(gfx::Point* point) OVERRIDE; |
63 virtual bool DrawsHandles() OVERRIDE; | 64 virtual bool DrawsHandles() OVERRIDE; |
64 virtual void OpenContextMenu(const gfx::Point& anchor) OVERRIDE; | 65 virtual void OpenContextMenu(const gfx::Point& anchor) OVERRIDE; |
65 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 66 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
66 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 67 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
67 virtual bool GetAcceleratorForCommandId( | 68 virtual bool GetAcceleratorForCommandId( |
68 int command_id, | 69 int command_id, |
69 ui::Accelerator* accelerator) OVERRIDE; | 70 ui::Accelerator* accelerator) OVERRIDE; |
70 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 71 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
71 virtual void DestroyTouchSelection() OVERRIDE; | 72 virtual void DestroyTouchSelection() OVERRIDE; |
72 | 73 |
73 protected: | 74 protected: |
74 TouchEditableImplAura(); | 75 TouchEditableImplAura(); |
75 | 76 |
76 private: | 77 private: |
77 friend class TouchEditableImplAuraTest; | 78 friend class TouchEditableImplAuraTest; |
78 | 79 |
| 80 // A convenience function that is called after scroll/fling/overscroll ends to |
| 81 // re-activate touch selection if necessary. |
| 82 void ScrollEnded(); |
| 83 |
79 void Cleanup(); | 84 void Cleanup(); |
80 | 85 |
81 // Rectangles for the selection anchor and focus. | 86 // Rectangles for the selection anchor and focus. |
82 gfx::Rect selection_anchor_rect_; | 87 gfx::Rect selection_anchor_rect_; |
83 gfx::Rect selection_focus_rect_; | 88 gfx::Rect selection_focus_rect_; |
84 | 89 |
85 // The current text input type. | 90 // The current text input type. |
86 ui::TextInputType text_input_type_; | 91 ui::TextInputType text_input_type_; |
87 | 92 |
88 RenderWidgetHostViewAura* rwhva_; | 93 RenderWidgetHostViewAura* rwhva_; |
89 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; | 94 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; |
90 | 95 |
91 // True if |rwhva_| is currently handling a gesture that could result in a | 96 // True if |rwhva_| is currently handling a gesture that could result in a |
92 // change in selection (long press, double tap or triple tap). | 97 // change in selection (long press, double tap or triple tap). |
93 bool selection_gesture_in_process_; | 98 bool selection_gesture_in_process_; |
94 | 99 |
95 // Set to true if handles are hidden when user is scrolling. Used to determine | 100 // Set to true if handles are hidden when user is scrolling. Used to determine |
96 // whether to re-show handles after a scrolling session. | 101 // whether to re-show handles after a scrolling session. |
97 bool handles_hidden_due_to_scroll_; | 102 bool handles_hidden_due_to_scroll_; |
98 | 103 |
99 // Keeps track of when the user is scrolling. | 104 // Keeps track of number of scrolls/flings/overscrolls in progress. |
100 bool scroll_in_progress_; | 105 int scrolls_in_progress_; |
101 | |
102 // Set to true when the page starts an overscroll. | |
103 bool overscroll_in_progress_; | |
104 | 106 |
105 // Used to track if a textfield was focused when the current tap gesture | 107 // Used to track if a textfield was focused when the current tap gesture |
106 // happened. | 108 // happened. |
107 bool textfield_was_focused_on_tap_; | 109 bool textfield_was_focused_on_tap_; |
108 | 110 |
109 DISALLOW_COPY_AND_ASSIGN(TouchEditableImplAura); | 111 DISALLOW_COPY_AND_ASSIGN(TouchEditableImplAura); |
110 }; | 112 }; |
111 | 113 |
112 } // namespace content | 114 } // namespace content |
113 | 115 |
114 #endif // CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_ | 116 #endif // CONTENT_BROWSER_WEB_CONTENTS_TOUCH_EDITABLE_IMPL_AURA_H_ |
OLD | NEW |