| 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 "content/common/content_export.h" | |
| 10 #include "ui/touch_selection/touch_selection_controller.h" | |
| 11 #include "ui/touch_selection/touch_selection_menu_runner.h" | |
| 12 | |
| 13 namespace content { | |
| 14 class RenderWidgetHostViewAura; | |
| 15 | |
| 16 // An implementation of |TouchSelectionControllerClient| to be used in Aura's | |
| 17 // implementation of touch selection for contents. | |
| 18 class CONTENT_EXPORT TouchSelectionControllerClientAura | |
| 19 : public ui::TouchSelectionControllerClient, | |
| 20 public ui::TouchSelectionMenuClient { | |
| 21 public: | |
| 22 explicit TouchSelectionControllerClientAura(RenderWidgetHostViewAura* rwhva); | |
| 23 ~TouchSelectionControllerClientAura() override; | |
| 24 | |
| 25 // Called when |rwhva_|'s window is moved, to update the quick menu's | |
| 26 // position. | |
| 27 void OnWindowMoved(); | |
| 28 | |
| 29 // Called on first touch down/last touch up to hide/show the quick menu. | |
| 30 void OnTouchDown(); | |
| 31 void OnTouchUp(); | |
| 32 | |
| 33 // Called when touch scroll starts/completes to hide/show touch handles and | |
| 34 // the quick menu. | |
| 35 void OnScrollStarted(); | |
| 36 void OnScrollCompleted(); | |
| 37 | |
| 38 private: | |
| 39 friend class TestTouchSelectionControllerClientAura; | |
| 40 class EnvPreTargetHandler; | |
| 41 | |
| 42 bool IsQuickMenuAllowed() const; | |
| 43 void ShowQuickMenu(); | |
| 44 void UpdateQuickMenu(); | |
| 45 | |
| 46 // ui::TouchSelectionControllerClient: | |
| 47 bool SupportsAnimation() const override; | |
| 48 void SetNeedsAnimate() override; | |
| 49 void MoveCaret(const gfx::PointF& position) override; | |
| 50 void MoveRangeSelectionExtent(const gfx::PointF& extent) override; | |
| 51 void SelectBetweenCoordinates(const gfx::PointF& base, | |
| 52 const gfx::PointF& extent) override; | |
| 53 void OnSelectionEvent(ui::SelectionEventType event) override; | |
| 54 scoped_ptr<ui::TouchHandleDrawable> CreateDrawable() override; | |
| 55 | |
| 56 // ui::TouchSelectionMenuClient: | |
| 57 bool IsCommandIdEnabled(int command_id) const override; | |
| 58 void ExecuteCommand(int command_id, int event_flags) override; | |
| 59 void RunContextMenu() override; | |
| 60 | |
| 61 // Not owned, non-null for the lifetime of this object. | |
| 62 RenderWidgetHostViewAura* rwhva_; | |
| 63 | |
| 64 base::Timer quick_menu_timer_; | |
| 65 bool touch_down_; | |
| 66 bool scroll_in_progress_; | |
| 67 bool handle_drag_in_progress_; | |
| 68 | |
| 69 bool show_quick_menu_immediately_for_test_; | |
| 70 | |
| 71 // A pre-target event handler for aura::Env which deactivates touch selection | |
| 72 // on mouse and keyboard events. | |
| 73 scoped_ptr<EnvPreTargetHandler> env_pre_target_handler_; | |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerClientAura); | |
| 76 }; | |
| 77 | |
| 78 } // namespace content | |
| 79 | |
| 80 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_SELECTION_CONTROLLER_CLIENT
_AURA_H_ | |
| OLD | NEW |