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

Side by Side Diff: chrome/browser/android/vr_shell/vr_input_manager.h

Issue 2380323003: Refactorings to vr controller code. (Closed)
Patch Set: Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_INPUT_MANAGER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_INPUT_MANAGER_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_INPUT_MANAGER_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_INPUT_MANAGER_H_
7 7
8 #include "base/memory/ref_counted.h"
9 #include "chrome/browser/android/vr_shell/vr_gesture.h"
8 #include "content/public/browser/render_widget_host.h" 10 #include "content/public/browser/render_widget_host.h"
9 #include "content/public/browser/render_widget_host_view.h" 11 #include "content/public/browser/render_widget_host_view.h"
10 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
11 #include "third_party/WebKit/public/web/WebInputEvent.h" 13 #include "third_party/WebKit/public/web/WebInputEvent.h"
12 14
13 namespace vr_shell { 15 namespace vr_shell {
14 16
15 class RenderFrameHost; 17 class RenderFrameHost;
16 18
17 class VrInputManager { 19 class VrInputManager
20 : public base::RefCountedThreadSafe<VrInputManager> {
18 public: 21 public:
19 explicit VrInputManager(content::WebContents* web_contents); 22 explicit VrInputManager(content::WebContents* web_contents);
20 23
21 ~VrInputManager(); 24 void ProcessUpdatedGesture(VrGesture gesture);
25 void SendGesture(VrGesture gesture);
asimjour 2016/10/03 14:40:16 SendGesture doesn't need to be public.
mthiesse 2016/10/03 15:39:15 Done.
22 26
23 void SendScrollEvent(int64_t time_ms, 27 void SendScrollEvent(int64_t time_ms,
24 float x, 28 float x,
25 float y, 29 float y,
26 float dx, 30 float dx,
27 float dy, 31 float dy,
28 int type); 32 int type);
29 void SendClickEvent(int64_t time_ms, float x, float y); 33 void SendClickEvent(int64_t time_ms, float x, float y);
30 void SendMouseMoveEvent(int64_t time_ms, float x, float y, int type); 34 void SendMouseMoveEvent(int64_t time_ms, float x, float y, int type);
31 35
32 void ScrollBegin(int64_t time_ms, 36 void ScrollBegin(int64_t time_ms,
33 float x, 37 float x,
34 float y, 38 float y,
35 float hintx, 39 float hintx,
36 float hinty, 40 float hinty,
37 bool target_viewport); 41 bool target_viewport);
38 void ScrollEnd(int64_t time_ms); 42 void ScrollEnd(int64_t time_ms);
39 void ScrollBy(int64_t time_ms, float x, float y, float dx, float dy); 43 void ScrollBy(int64_t time_ms, float x, float y, float dx, float dy);
40 void PinchBegin(int64_t time_ms, float x, float y); 44 void PinchBegin(int64_t time_ms, float x, float y);
41 void PinchEnd(int64_t time_ms); 45 void PinchEnd(int64_t time_ms);
42 void PinchBy(int64_t time_ms, float x, float y, float delta); 46 void PinchBy(int64_t time_ms, float x, float y, float delta);
43 void SendPinchEvent(int64_t time_ms, float x, float y, float dz, int type); 47 void SendPinchEvent(int64_t time_ms, float x, float y, float dz, int type);
44 48
49 protected:
50 friend class base::RefCountedThreadSafe<VrInputManager>;
51 virtual ~VrInputManager();
52
45 private: 53 private:
46 void SendGestureEvent(const blink::WebGestureEvent& event); 54 void SendGestureEvent(const blink::WebGestureEvent& event);
47 void SendMouseEvent(const blink::WebMouseEvent& event); 55 void SendMouseEvent(const blink::WebMouseEvent& event);
48 blink::WebGestureEvent MakeGestureEvent(blink::WebInputEvent::Type type, 56 blink::WebGestureEvent MakeGestureEvent(blink::WebInputEvent::Type type,
49 int64_t time_ms, 57 int64_t time_ms,
50 float x, 58 float x,
51 float y) const; 59 float y) const;
52 60
53 // Device scale factor. 61 // Device scale factor.
54 float dpi_scale_; 62 float dpi_scale_;
55 63
56 content::WebContents* web_contents_; 64 content::WebContents* web_contents_;
57 DISALLOW_COPY_AND_ASSIGN(VrInputManager); 65 DISALLOW_COPY_AND_ASSIGN(VrInputManager);
58 }; 66 };
59 67
60 } // namespace vr_shell 68 } // namespace vr_shell
61 69
62 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_INPUT_MANAGER_H_ 70 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_INPUT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698