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