| OLD | NEW |
| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 10 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
| 11 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 11 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 12 #include "third_party/WebKit/public/platform/WebMouseEvent.h" | 12 #include "third_party/WebKit/public/platform/WebMouseEvent.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class WebContents; | 15 class WebContents; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace vr_shell { | 18 namespace vr_shell { |
| 19 | 19 |
| 20 // Note: This class is not thread safe and must only be used from main thread. | 20 // Note: This class is not thread safe and must only be used from main thread. |
| 21 class VrInputManager { | 21 class VrInputManager { |
| 22 public: | 22 public: |
| 23 explicit VrInputManager(content::WebContents* web_contents); | 23 explicit VrInputManager(content::WebContents* web_contents); |
| 24 ~VrInputManager(); | 24 ~VrInputManager(); |
| 25 | 25 |
| 26 base::WeakPtr<VrInputManager> GetWeakPtr(); | |
| 27 void ProcessUpdatedGesture(std::unique_ptr<blink::WebInputEvent> event); | 26 void ProcessUpdatedGesture(std::unique_ptr<blink::WebInputEvent> event); |
| 28 | 27 |
| 29 private: | 28 private: |
| 30 void SendGesture(const blink::WebGestureEvent& gesture); | 29 void SendGesture(const blink::WebGestureEvent& gesture); |
| 31 void ForwardGestureEvent(const blink::WebGestureEvent& gesture); | 30 void ForwardGestureEvent(const blink::WebGestureEvent& gesture); |
| 32 void ForwardMouseEvent(const blink::WebMouseEvent& mouse_event); | 31 void ForwardMouseEvent(const blink::WebMouseEvent& mouse_event); |
| 33 | 32 |
| 34 content::WebContents* web_contents_; | 33 content::WebContents* web_contents_; |
| 35 | 34 |
| 36 base::WeakPtrFactory<VrInputManager> weak_ptr_factory_; | |
| 37 | |
| 38 DISALLOW_COPY_AND_ASSIGN(VrInputManager); | 35 DISALLOW_COPY_AND_ASSIGN(VrInputManager); |
| 39 }; | 36 }; |
| 40 | 37 |
| 41 } // namespace vr_shell | 38 } // namespace vr_shell |
| 42 | 39 |
| 43 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_INPUT_MANAGER_H_ | 40 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_INPUT_MANAGER_H_ |
| OLD | NEW |