OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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_FRAME_HOST_TOUCH_SELECTION_CONTROLLER_CLIENT_CHILD_FRAME
_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_TOUCH_SELECTION_CONTROLLER_CLIENT_CHILD_FRAME
_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "cc/input/selection.h" |
| 10 #include "content/common/content_export.h" |
| 11 #include "ui/touch_selection/touch_selection_controller.h" |
| 12 #include "ui/touch_selection/touch_selection_menu_runner.h" |
| 13 |
| 14 namespace content { |
| 15 class RenderWidgetHostViewChildFrame; |
| 16 class TouchSelectionControllerClientManager; |
| 17 |
| 18 // An implementation of |TouchSelectionControllerClient| to be used by |
| 19 // implementations of TouchSelectionControllerClientManager. |
| 20 class CONTENT_EXPORT TouchSelectionControllerClientChildFrame |
| 21 : public ui::TouchSelectionControllerClient, |
| 22 public ui::TouchSelectionMenuClient { |
| 23 public: |
| 24 TouchSelectionControllerClientChildFrame( |
| 25 RenderWidgetHostViewChildFrame* rwhv, |
| 26 TouchSelectionControllerClientManager* manager); |
| 27 ~TouchSelectionControllerClientChildFrame() override; |
| 28 |
| 29 void UpdateSelectionBoundsIfNeeded( |
| 30 const cc::Selection<gfx::SelectionBound>& selection, |
| 31 float device_scale_factor); |
| 32 |
| 33 private: |
| 34 // ui::TouchSelectionControllerClient: |
| 35 bool SupportsAnimation() const override; |
| 36 void SetNeedsAnimate() override; |
| 37 void MoveCaret(const gfx::PointF& position) override; |
| 38 void MoveRangeSelectionExtent(const gfx::PointF& extent) override; |
| 39 void SelectBetweenCoordinates(const gfx::PointF& base, |
| 40 const gfx::PointF& extent) override; |
| 41 void OnSelectionEvent(ui::SelectionEventType event) override; |
| 42 std::unique_ptr<ui::TouchHandleDrawable> CreateDrawable() override; |
| 43 |
| 44 // ui::TouchSelectionMenuClient: |
| 45 bool IsCommandIdEnabled(int command_id) const override; |
| 46 void ExecuteCommand(int command_id, int event_flags) override; |
| 47 void RunContextMenu() override; |
| 48 |
| 49 gfx::Point ConvertFromRoot(const gfx::PointF& point) const; |
| 50 |
| 51 // Not owned, non-null for the lifetime of this object. |
| 52 RenderWidgetHostViewChildFrame* rwhv_; |
| 53 TouchSelectionControllerClientManager* manager_; |
| 54 |
| 55 // The last selection bounds reported by the view. |
| 56 gfx::SelectionBound selection_start_; |
| 57 gfx::SelectionBound selection_end_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerClientChildFrame); |
| 60 }; |
| 61 |
| 62 } // namespace content |
| 63 #endif // CONTENT_BROWSER_FRAME_HOST_TOUCH_SELECTION_CONTROLLER_CLIENT_CHILD_FR
AME_H_ |
OLD | NEW |