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

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

Issue 2862893003: [CRD iOS] Inject mouse events to the host (Closed)
Patch Set: Resolve Feedback 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/direct_input_strategy.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
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_GESTURE_INTERPRETER_H_ 5 #ifndef REMOTING_CLIENT_GESTURE_INTERPRETER_H_
6 #define REMOTING_CLIENT_GESTURE_INTERPRETER_H_ 6 #define REMOTING_CLIENT_GESTURE_INTERPRETER_H_
7 7
8 #include <memory>
9
10 #include "remoting/client/chromoting_session.h"
8 #include "remoting/client/desktop_viewport.h" 11 #include "remoting/client/desktop_viewport.h"
12 #include "remoting/proto/event.pb.h"
9 13
10 namespace remoting { 14 namespace remoting {
11 15
16 class InputStrategy;
17
12 // This is a class for interpreting a raw touch input into actions like moving 18 // This is a class for interpreting a raw touch input into actions like moving
13 // the viewport and injecting mouse clicks. 19 // the viewport and injecting mouse clicks.
14 class GestureInterpreter { 20 class GestureInterpreter {
15 public: 21 public:
22 enum GestureState { GESTURE_BEGAN, GESTURE_CHANGED, GESTURE_ENDED };
23
16 GestureInterpreter( 24 GestureInterpreter(
17 const DesktopViewport::TransformationCallback& on_transformation_changed); 25 const DesktopViewport::TransformationCallback& on_transformation_changed,
26 ChromotingSession* input_stub);
18 ~GestureInterpreter(); 27 ~GestureInterpreter();
19 28
20 // Coordinates of the OpenGL view surface will be used. 29 // Coordinates of the OpenGL view surface will be used.
21 void Pinch(float pivot_x, float pivot_y, float scale); 30 void Pinch(float pivot_x, float pivot_y, float scale);
22 void Pan(float translation_x, float translation_y); 31 void Pan(float translation_x, float translation_y);
23 void Tap(float x, float y); 32 void Tap(float x, float y);
24 void LongPress(float x, float y); 33 void TwoFingerTap(float x, float y);
34
35 // Caller is expected to call both Pan() and LongPress() when long-press is in
36 // progress.
37 void LongPress(float x, float y, GestureState state);
25 38
26 void OnSurfaceSizeChanged(int width, int height); 39 void OnSurfaceSizeChanged(int width, int height);
27 void OnDesktopSizeChanged(int width, int height); 40 void OnDesktopSizeChanged(int width, int height);
28 41
29 private: 42 private:
43 void InjectMouseClick(float x,
44 float y,
45 protocol::MouseEvent_MouseButton button);
46
47 std::unique_ptr<InputStrategy> input_strategy_;
30 DesktopViewport viewport_; 48 DesktopViewport viewport_;
49 ChromotingSession* input_stub_;
50 bool is_dragging_mode_ = false;
31 51
32 // GestureInterpreter is neither copyable nor movable. 52 // GestureInterpreter is neither copyable nor movable.
33 GestureInterpreter(const GestureInterpreter&) = delete; 53 GestureInterpreter(const GestureInterpreter&) = delete;
34 GestureInterpreter& operator=(const GestureInterpreter&) = delete; 54 GestureInterpreter& operator=(const GestureInterpreter&) = delete;
35 }; 55 };
36 56
37 } // namespace remoting 57 } // namespace remoting
38 #endif // REMOTING_CLIENT_GESTURE_INTERPRETER_H_ 58 #endif // REMOTING_CLIENT_GESTURE_INTERPRETER_H_
OLDNEW
« no previous file with comments | « remoting/client/direct_input_strategy.cc ('k') | remoting/client/gesture_interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698