Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: remoting/client/ui/input_strategy.h

Issue 2903623002: Moving input related classes to the input folder. (Closed)
Patch Set: Hide gesture code from nacl. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 REMOTING_CLIENT_UI_INPUT_STRATEGY_H_
6 #define REMOTING_CLIENT_UI_INPUT_STRATEGY_H_
7
8 #include "remoting/client/ui/view_matrix.h"
9
10 namespace remoting {
11
12 class DesktopViewport;
13
14 // This is an interface used by GestureInterpreter to customize the way gestures
15 // are handled.
16 class InputStrategy {
17 public:
18 enum InputFeedbackType {
19 TAP_FEEDBACK,
20 DRAG_FEEDBACK,
21 };
22
23 enum Gesture {
24 NONE,
25 ZOOM,
26 DRAG,
27 };
28
29 virtual ~InputStrategy() {}
30
31 // Called when the GestureInterpreter receives a zoom gesture. The
32 // implementation is responsible for modifying the viewport and observing the
33 // change.
34 virtual void HandleZoom(const ViewMatrix::Point& pivot,
35 float scale,
36 DesktopViewport* viewport) = 0;
37
38 // Called when the GestureInterpreter receives a pan gesture. The
39 // implementation is responsible for modifying the viewport and observing the
40 // change.
41 // simultaneous_gesture: Gesture that is simultaneously in progress.
42 // Returns true if this changes the cursor position.
43 virtual bool HandlePan(const ViewMatrix::Vector2D& translation,
44 Gesture simultaneous_gesture,
45 DesktopViewport* viewport) = 0;
46
47 // Called when a touch input (which will end up injecting a mouse event at
48 // certain position in the host) is done at |touch_point|.
49 // The implementation should move the cursor to proper position.
50 //
51 // Returns true if |touch_point| is a valid input, false otherwise. If the
52 // input is not valid, the implementation should not change its cursor
53 // position.
54 virtual bool TrackTouchInput(const ViewMatrix::Point& touch_point,
55 const DesktopViewport& viewport) = 0;
56
57 // Returns the current cursor position.
58 virtual ViewMatrix::Point GetCursorPosition() const = 0;
59
60 // Maps a vector (or movement) in the surface coordinate to the vector to be
61 // used on the desktop. For example it can be used to map a scroll gesture
62 // on the screen to change in mouse wheel position.
63 virtual ViewMatrix::Vector2D MapScreenVectorToDesktop(
64 const ViewMatrix::Vector2D& delta,
65 const DesktopViewport& viewport) const = 0;
66
67 // Returns the maximum radius of the feedback animation on the surface's
68 // coordinate for the given input type. The feedback will then be shown on the
69 // cursor positions returned by GetCursorPosition(). Return 0 if no feedback
70 // should be shown.
71 virtual float GetFeedbackRadius(InputFeedbackType type) const = 0;
72
73 // Returns true if the input strategy maintains a visible cursor on the
74 // desktop.
75 virtual bool IsCursorVisible() const = 0;
76 };
77
78 } // namespace remoting
79 #endif // REMOTING_CLIENT_UI_INPUT_STRATEGY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698