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

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

Issue 2879383002: [CRD iOS] Move UI stuff into a subdirectory (Closed)
Patch Set: Fix include 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/fling_tracker.cc ('k') | remoting/client/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
(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_GESTURE_INTERPRETER_H_
6 #define REMOTING_CLIENT_GESTURE_INTERPRETER_H_
7
8 #include <memory>
9
10 #include "remoting/client/chromoting_session.h"
11 #include "remoting/client/desktop_viewport.h"
12 #include "remoting/client/fling_animation.h"
13 #include "remoting/proto/event.pb.h"
14
15 namespace remoting {
16
17 class InputStrategy;
18
19 // This is a class for interpreting a raw touch input into actions like moving
20 // the viewport and injecting mouse clicks.
21 class GestureInterpreter {
22 public:
23 enum GestureState { GESTURE_BEGAN, GESTURE_CHANGED, GESTURE_ENDED };
24
25 GestureInterpreter(
26 const DesktopViewport::TransformationCallback& on_transformation_changed,
27 ChromotingSession* input_stub);
28 ~GestureInterpreter();
29
30 // Coordinates of the OpenGL view surface will be used.
31
32 // This can happen in conjunction with Pan().
33 void Pinch(float pivot_x, float pivot_y, float scale);
34
35 // 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
37 // pinch gesture. Two-finger pan without pinch is consider a scroll gesture.
38 void Pan(float translation_x, float translation_y);
39
40 // Called when the user did a one-finger tap.
41 void Tap(float x, float y);
42
43 void TwoFingerTap(float x, float y);
44
45 // Caller is expected to call both Pan() and LongPress() when long-press is in
46 // progress.
47 void LongPress(float x, float y, GestureState state);
48
49 // Called when the user has just done a one-finger pan (no long-press or
50 // pinching) and the pan gesture still has some final velocity.
51 void OneFingerFling(float velocity_x, float velocity_y);
52
53 // Called to process one animation frame.
54 void ProcessAnimations();
55
56 void OnSurfaceSizeChanged(int width, int height);
57 void OnDesktopSizeChanged(int width, int height);
58
59 private:
60 void PanWithoutAbortAnimations(float translation_x, float translation_y);
61
62 void AbortAnimations();
63
64 void InjectMouseClick(float x,
65 float y,
66 protocol::MouseEvent_MouseButton button);
67
68 std::unique_ptr<InputStrategy> input_strategy_;
69 DesktopViewport viewport_;
70 ChromotingSession* input_stub_;
71 bool is_dragging_mode_ = false;
72
73 FlingAnimation pan_animation_;
74
75 // GestureInterpreter is neither copyable nor movable.
76 GestureInterpreter(const GestureInterpreter&) = delete;
77 GestureInterpreter& operator=(const GestureInterpreter&) = delete;
78 };
79
80 } // namespace remoting
81 #endif // REMOTING_CLIENT_GESTURE_INTERPRETER_H_
OLDNEW
« no previous file with comments | « remoting/client/fling_tracker.cc ('k') | remoting/client/gesture_interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698