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

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

Issue 2380323003: Refactorings to vr controller code. (Closed)
Patch Set: Fix BUILD.gn 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);
22 25
23 void SendScrollEvent(int64_t time_ms, 26 void SendScrollEvent(int64_t time_ms,
24 float x, 27 float x,
25 float y, 28 float y,
26 float dx, 29 float dx,
27 float dy, 30 float dy,
28 int type); 31 int type);
29 void SendClickEvent(int64_t time_ms, float x, float y); 32 void SendClickEvent(int64_t time_ms, float x, float y);
30 void SendMouseMoveEvent(int64_t time_ms, float x, float y, int type); 33 void SendMouseMoveEvent(int64_t time_ms, float x, float y, int type);
31 34
32 void ScrollBegin(int64_t time_ms, 35 void ScrollBegin(int64_t time_ms,
33 float x, 36 float x,
34 float y, 37 float y,
35 float hintx, 38 float hintx,
36 float hinty, 39 float hinty,
37 bool target_viewport); 40 bool target_viewport);
38 void ScrollEnd(int64_t time_ms); 41 void ScrollEnd(int64_t time_ms);
39 void ScrollBy(int64_t time_ms, float x, float y, float dx, float dy); 42 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); 43 void PinchBegin(int64_t time_ms, float x, float y);
41 void PinchEnd(int64_t time_ms); 44 void PinchEnd(int64_t time_ms);
42 void PinchBy(int64_t time_ms, float x, float y, float delta); 45 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); 46 void SendPinchEvent(int64_t time_ms, float x, float y, float dz, int type);
44 47
48 protected:
49 friend class base::RefCountedThreadSafe<VrInputManager>;
50 virtual ~VrInputManager();
51
45 private: 52 private:
46 void SendGestureEvent(const blink::WebGestureEvent& event); 53 void SendGesture(VrGesture gesture);
47 void SendMouseEvent(const blink::WebMouseEvent& event); 54 void ForwardGestureEvent(const blink::WebGestureEvent& event);
55 void ForwardMouseEvent(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
« no previous file with comments | « chrome/browser/android/vr_shell/vr_gesture.h ('k') | chrome/browser/android/vr_shell/vr_input_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698