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

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

Issue 2879743002: [CRD iOS] Hook the touch input feedback (Closed)
Patch Set: Use the ui task poster 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
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_INPUT_STRATEGY_H_ 5 #ifndef REMOTING_CLIENT_INPUT_STRATEGY_H_
6 #define REMOTING_CLIENT_INPUT_STRATEGY_H_ 6 #define REMOTING_CLIENT_INPUT_STRATEGY_H_
7 7
8 namespace remoting { 8 namespace remoting {
9 9
10 class DesktopViewport; 10 class DesktopViewport;
11 11
12 // This is an interface used by GestureInterpreter to customize the way gestures 12 // This is an interface used by GestureInterpreter to customize the way gestures
13 // are handled. 13 // are handled.
14 class InputStrategy { 14 class InputStrategy {
15 public: 15 public:
16 enum InputFeedbackType {
17 TAP_FEEDBACK,
18 LONG_PRESS_FEEDBACK,
19 };
20
16 virtual ~InputStrategy() {} 21 virtual ~InputStrategy() {}
17 22
18 // Called when the GestureInterpreter receives a pinch gesture. The 23 // Called when the GestureInterpreter receives a pinch gesture. The
19 // implementation is responsible for modifying the viewport and observing the 24 // implementation is responsible for modifying the viewport and observing the
20 // change. 25 // change.
21 virtual void HandlePinch(float pivot_x, 26 virtual void HandlePinch(float pivot_x,
22 float pivot_y, 27 float pivot_y,
23 float scale, 28 float scale,
24 DesktopViewport* viewport) = 0; 29 DesktopViewport* viewport) = 0;
25 30
26 // Called when the GestureInterpreter receives a pan gesture. The 31 // Called when the GestureInterpreter receives a pan gesture. The
27 // implementation is responsible for modifying the viewport and observing the 32 // implementation is responsible for modifying the viewport and observing the
28 // change. 33 // change.
29 // is_dragging_mode: true if the user is trying to drag something while 34 // is_dragging_mode: true if the user is trying to drag something while
30 // panning on the screen. 35 // panning on the screen.
31 virtual void HandlePan(float translation_x, 36 virtual void HandlePan(float translation_x,
32 float translation_y, 37 float translation_y,
33 bool is_dragging_mode, 38 bool is_dragging_mode,
34 DesktopViewport* viewport) = 0; 39 DesktopViewport* viewport) = 0;
35 40
36 // Called when a gesture is done at location (touch_x, touch_y) and the 41 // Called when a touch input (which will end up injecting a mouse event at
37 // GestureInterpreter needs to get back the cursor position to inject mouse 42 // certain position in the host) is done at location (touch_x, touch_y).
38 // the mouse event. 43 // The implementation should move the cursor to proper position.
39 virtual void FindCursorPositions(float touch_x, 44 virtual void TrackTouchInput(float touch_x,
40 float touch_y, 45 float touch_y,
41 const DesktopViewport& viewport, 46 const DesktopViewport& viewport) = 0;
42 float* cursor_x, 47
43 float* cursor_y) = 0; 48 // Writes the cursor position to cursor_x and cursor_y.
49 virtual void GetCursorPosition(float* cursor_x, float* cursor_y) const = 0;
50
51 // Returns the maximum radius of the feedback animation on the surface's
52 // coordinate for the given input type. The feedback will then be shown on the
53 // cursor positions returned by FindCursorPositions(). Return 0 if no feedback
54 // should be shown.
55 virtual float GetFeedbackRadius(InputFeedbackType type) const = 0;
44 56
45 // Returns true if the input strategy maintains a visible cursor on the 57 // Returns true if the input strategy maintains a visible cursor on the
46 // desktop. 58 // desktop.
47 virtual bool IsCursorVisible() const = 0; 59 virtual bool IsCursorVisible() const = 0;
48 }; 60 };
49 61
50 } // namespace remoting 62 } // namespace remoting
51 #endif // REMOTING_CLIENT_INPUT_STRATEGY_H_ 63 #endif // REMOTING_CLIENT_INPUT_STRATEGY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698