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

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

Issue 2879743002: [CRD iOS] Hook the touch input feedback (Closed)
Patch Set: Fix dependency and race condition 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
« no previous file with comments | « remoting/client/ui/direct_input_strategy.cc ('k') | remoting/client/ui/gesture_interpreter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_UI_GESTURE_INTERPRETER_H_ 5 #ifndef REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_
6 #define REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ 6 #define REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "remoting/client/chromoting_session.h"
11 #include "remoting/client/ui/desktop_viewport.h" 10 #include "remoting/client/ui/desktop_viewport.h"
12 #include "remoting/client/ui/fling_animation.h" 11 #include "remoting/client/ui/fling_animation.h"
12 #include "remoting/client/ui/input_strategy.h"
13 #include "remoting/proto/event.pb.h" 13 #include "remoting/proto/event.pb.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 16
17 class InputStrategy; 17 class ChromotingSession;
18 class RendererProxy;
18 19
19 // This is a class for interpreting a raw touch input into actions like moving 20 // This is a class for interpreting a raw touch input into actions like moving
20 // the viewport and injecting mouse clicks. 21 // the viewport and injecting mouse clicks.
21 class GestureInterpreter { 22 class GestureInterpreter {
22 public: 23 public:
23 enum GestureState { GESTURE_BEGAN, GESTURE_CHANGED, GESTURE_ENDED }; 24 enum GestureState { GESTURE_BEGAN, GESTURE_CHANGED, GESTURE_ENDED };
24 25
25 GestureInterpreter( 26 GestureInterpreter(RendererProxy* renderer, ChromotingSession* input_stub);
26 const DesktopViewport::TransformationCallback& on_transformation_changed,
27 ChromotingSession* input_stub);
28 ~GestureInterpreter(); 27 ~GestureInterpreter();
29 28
30 // Coordinates of the OpenGL view surface will be used. 29 // Coordinates of the OpenGL view surface will be used.
31 30
32 // This can happen in conjunction with Pan(). 31 // This can happen in conjunction with Pan().
33 void Pinch(float pivot_x, float pivot_y, float scale); 32 void Pinch(float pivot_x, float pivot_y, float scale);
34 33
35 // Called whenever the user did a pan gesture. It can be one-finger pan, no 34 // Called whenever the user did a pan gesture. It can be one-finger pan, no
36 // matter long-press in on or not, or two-finger pan in conjunction with the 35 // matter long-press in on or not, or two-finger pan in conjunction with pinch
37 // pinch gesture. Two-finger pan without pinch is consider a scroll gesture. 36 // and long-press. Two-finger pan without pinch is consider a scroll gesture.
38 void Pan(float translation_x, float translation_y); 37 void Pan(float translation_x, float translation_y);
39 38
40 // Called when the user did a one-finger tap. 39 // Called when the user did a one-finger tap.
41 void Tap(float x, float y); 40 void Tap(float x, float y);
42 41
43 void TwoFingerTap(float x, float y); 42 void TwoFingerTap(float x, float y);
44 43
45 // Caller is expected to call both Pan() and LongPress() when long-press is in 44 // Caller is expected to call both Pan() and LongPress() when long-press is in
46 // progress. 45 // progress.
47 void LongPress(float x, float y, GestureState state); 46 void LongPress(float x, float y, GestureState state);
(...skipping 10 matching lines...) Expand all
58 57
59 private: 58 private:
60 void PanWithoutAbortAnimations(float translation_x, float translation_y); 59 void PanWithoutAbortAnimations(float translation_x, float translation_y);
61 60
62 void AbortAnimations(); 61 void AbortAnimations();
63 62
64 void InjectMouseClick(float x, 63 void InjectMouseClick(float x,
65 float y, 64 float y,
66 protocol::MouseEvent_MouseButton button); 65 protocol::MouseEvent_MouseButton button);
67 66
67 // Tracks the touch point and gets back the cursor position from the input
68 // strategy.
69 ViewMatrix::Point TrackAndGetPosition(float touch_x, float touch_y);
70
71 // If the cursor is visible, send the cursor position from the input strategy
72 // to the renderer.
73 void SetCursorPositionOnRenderer();
74
75 // Starts the given feedback at (cursor_x, cursor_y) if the feedback radius
76 // is non-zero.
77 void StartInputFeedback(float cursor_x,
78 float cursor_y,
79 InputStrategy::InputFeedbackType feedback_type);
80
68 std::unique_ptr<InputStrategy> input_strategy_; 81 std::unique_ptr<InputStrategy> input_strategy_;
69 DesktopViewport viewport_; 82 DesktopViewport viewport_;
83 RendererProxy* renderer_;
70 ChromotingSession* input_stub_; 84 ChromotingSession* input_stub_;
71 bool is_dragging_mode_ = false; 85 bool is_dragging_mode_ = false;
72 86
73 FlingAnimation pan_animation_; 87 FlingAnimation pan_animation_;
74 88
75 // GestureInterpreter is neither copyable nor movable. 89 // GestureInterpreter is neither copyable nor movable.
76 GestureInterpreter(const GestureInterpreter&) = delete; 90 GestureInterpreter(const GestureInterpreter&) = delete;
77 GestureInterpreter& operator=(const GestureInterpreter&) = delete; 91 GestureInterpreter& operator=(const GestureInterpreter&) = delete;
78 }; 92 };
79 93
80 } // namespace remoting 94 } // namespace remoting
81 #endif // REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_ 95 #endif // REMOTING_CLIENT_UI_GESTURE_INTERPRETER_H_
OLDNEW
« no previous file with comments | « remoting/client/ui/direct_input_strategy.cc ('k') | remoting/client/ui/gesture_interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698