OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_TOUCH_SELECTION_CONTROLLER_CLIENT_AU
RA_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_CLIENT_AU
RA_H_ |
| 7 |
| 8 #include "base/timer/timer.h" |
| 9 #include "ui/touch_selection/touch_selection_controller.h" |
| 10 #include "ui/touch_selection/touch_selection_menu_runner.h" |
| 11 |
| 12 namespace content { |
| 13 class RenderWidgetHostViewAura; |
| 14 |
| 15 // An implementation of |TouchSelectionControllerClient| to be used in Aura's |
| 16 // implementation of touch selection for contents. |
| 17 class TouchSelectionControllerClientAura |
| 18 : public ui::TouchSelectionControllerClient, |
| 19 public ui::TouchSelectionMenuClient { |
| 20 public: |
| 21 explicit TouchSelectionControllerClientAura(RenderWidgetHostViewAura* rwhva); |
| 22 ~TouchSelectionControllerClientAura() override; |
| 23 |
| 24 void OnWindowMoved(); |
| 25 void OnTouchDown(); |
| 26 void OnTouchUp(); |
| 27 void OnScrollStarted(); |
| 28 void OnScrollCompleted(); |
| 29 |
| 30 private: |
| 31 class EnvPreTargetHandler; |
| 32 |
| 33 bool IsQuickMenuAllowed() const; |
| 34 void ShowQuickMenu(); |
| 35 void UpdateQuickMenu(); |
| 36 |
| 37 // ui::TouchSelectionControllerClient: |
| 38 bool SupportsAnimation() const override; |
| 39 void SetNeedsAnimate() override; |
| 40 void MoveCaret(const gfx::PointF& position) override; |
| 41 void MoveRangeSelectionExtent(const gfx::PointF& extent) override; |
| 42 void SelectBetweenCoordinates(const gfx::PointF& base, |
| 43 const gfx::PointF& extent) override; |
| 44 void OnSelectionEvent(ui::SelectionEventType event) override; |
| 45 scoped_ptr<ui::TouchHandleDrawable> CreateDrawable() override; |
| 46 |
| 47 // ui::TouchSelectionMenuClient: |
| 48 bool IsCommandIdEnabled(int command_id) const override; |
| 49 void ExecuteCommand(int command_id, int event_flags) override; |
| 50 void RunContextMenu() override; |
| 51 |
| 52 // Not owned, non-null for the lifetime of this object. |
| 53 RenderWidgetHostViewAura* rwhva_; |
| 54 |
| 55 base::Timer quick_menu_timer_; |
| 56 bool touch_down_; |
| 57 bool scroll_in_progress_; |
| 58 bool handle_drag_in_progress_; |
| 59 |
| 60 // A pre-target event handler for aura::Env which deactivates touch selection |
| 61 // on mouse and keyboard events. |
| 62 scoped_ptr<EnvPreTargetHandler> env_pre_target_handler_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerClientAura); |
| 65 }; |
| 66 |
| 67 } // namespace content |
| 68 |
| 69 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_CLIENT
_AURA_H_ |
OLD | NEW |