| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 REMOTING_CLIENT_UI_INPUT_STRATEGY_H_ | 5 #ifndef REMOTING_CLIENT_UI_INPUT_STRATEGY_H_ |
| 6 #define REMOTING_CLIENT_UI_INPUT_STRATEGY_H_ | 6 #define REMOTING_CLIENT_UI_INPUT_STRATEGY_H_ |
| 7 | 7 |
| 8 #include "remoting/client/ui/view_matrix.h" | 8 #include "remoting/client/ui/view_matrix.h" |
| 9 | 9 |
| 10 namespace remoting { | 10 namespace remoting { |
| 11 | 11 |
| 12 class DesktopViewport; | 12 class DesktopViewport; |
| 13 | 13 |
| 14 // This is an interface used by GestureInterpreter to customize the way gestures | 14 // This is an interface used by GestureInterpreter to customize the way gestures |
| 15 // are handled. | 15 // are handled. |
| 16 class InputStrategy { | 16 class InputStrategy { |
| 17 public: | 17 public: |
| 18 enum InputFeedbackType { | 18 enum InputFeedbackType { |
| 19 TAP_FEEDBACK, | 19 TAP_FEEDBACK, |
| 20 LONG_PRESS_FEEDBACK, | 20 DRAG_FEEDBACK, |
| 21 }; |
| 22 |
| 23 enum Gesture { |
| 24 NONE, |
| 25 ZOOM, |
| 26 DRAG, |
| 21 }; | 27 }; |
| 22 | 28 |
| 23 virtual ~InputStrategy() {} | 29 virtual ~InputStrategy() {} |
| 24 | 30 |
| 25 // Called when the GestureInterpreter receives a pinch gesture. The | 31 // Called when the GestureInterpreter receives a zoom gesture. The |
| 26 // implementation is responsible for modifying the viewport and observing the | 32 // implementation is responsible for modifying the viewport and observing the |
| 27 // change. | 33 // change. |
| 28 virtual void HandlePinch(const ViewMatrix::Point& pivot, | 34 virtual void HandleZoom(const ViewMatrix::Point& pivot, |
| 29 float scale, | 35 float scale, |
| 30 DesktopViewport* viewport) = 0; | 36 DesktopViewport* viewport) = 0; |
| 31 | 37 |
| 32 // Called when the GestureInterpreter receives a pan gesture. The | 38 // Called when the GestureInterpreter receives a pan gesture. The |
| 33 // implementation is responsible for modifying the viewport and observing the | 39 // implementation is responsible for modifying the viewport and observing the |
| 34 // change. | 40 // change. |
| 35 // is_dragging_mode: true if the user is trying to drag something while | 41 // simultaneous_gesture: Gesture that is simultaneously in progress. |
| 36 // panning on the screen. | 42 // Returns true if this changes the cursor position. |
| 37 virtual void HandlePan(const ViewMatrix::Vector2D& translation, | 43 virtual bool HandlePan(const ViewMatrix::Vector2D& translation, |
| 38 bool is_dragging_mode, | 44 Gesture simultaneous_gesture, |
| 39 DesktopViewport* viewport) = 0; | 45 DesktopViewport* viewport) = 0; |
| 40 | 46 |
| 41 // Called when a touch input (which will end up injecting a mouse event at | 47 // Called when a touch input (which will end up injecting a mouse event at |
| 42 // certain position in the host) is done at |touch_point|. | 48 // certain position in the host) is done at |touch_point|. |
| 43 // The implementation should move the cursor to proper position. | 49 // The implementation should move the cursor to proper position. |
| 44 virtual void TrackTouchInput(const ViewMatrix::Point& touch_point, | 50 virtual void TrackTouchInput(const ViewMatrix::Point& touch_point, |
| 45 const DesktopViewport& viewport) = 0; | 51 const DesktopViewport& viewport) = 0; |
| 46 | 52 |
| 47 // Returns the current cursor position. | 53 // Returns the current cursor position. |
| 48 virtual ViewMatrix::Point GetCursorPosition() const = 0; | 54 virtual ViewMatrix::Point GetCursorPosition() const = 0; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 60 // should be shown. | 66 // should be shown. |
| 61 virtual float GetFeedbackRadius(InputFeedbackType type) const = 0; | 67 virtual float GetFeedbackRadius(InputFeedbackType type) const = 0; |
| 62 | 68 |
| 63 // Returns true if the input strategy maintains a visible cursor on the | 69 // Returns true if the input strategy maintains a visible cursor on the |
| 64 // desktop. | 70 // desktop. |
| 65 virtual bool IsCursorVisible() const = 0; | 71 virtual bool IsCursorVisible() const = 0; |
| 66 }; | 72 }; |
| 67 | 73 |
| 68 } // namespace remoting | 74 } // namespace remoting |
| 69 #endif // REMOTING_CLIENT_UI_INPUT_STRATEGY_H_ | 75 #endif // REMOTING_CLIENT_UI_INPUT_STRATEGY_H_ |
| OLD | NEW |