Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/task_runner_util.h" | |
| 10 #include "chrome/browser/android/vr_shell/vr_controller.h" | |
| 11 #include "chrome/browser/android/vr_shell/vr_gesture.h" | |
| 12 #include "content/public/browser/android/content_view_core.h" | |
| 13 #include "content/public/browser/android/vr_input_manager.h" | |
| 14 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr.h" | |
| 15 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr_controller.h" | |
| 16 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr_types.h" | |
| 17 | |
| 18 namespace vr_shell { | |
| 19 | |
| 20 class VrControllerManager | |
| 21 : public base::RefCountedThreadSafe<VrControllerManager> { | |
| 22 public: | |
| 23 // Controller API entry point. | |
| 24 VrControllerManager(); | |
| 25 | |
| 26 // Must be called when the Activity gets onResume(). | |
| 27 void OnResume(); | |
| 28 | |
| 29 // Must be called when the Activity gets onPause(). | |
| 30 void OnPause(); | |
| 31 | |
| 32 // Must be called when the GL renderer gets onSurfaceCreated(). | |
| 33 void Initialize(gvr_context_* gvr_context); | |
| 34 | |
| 35 // Must be called when the GL renderer gets onDrawFrame(). | |
| 36 VrGesture Update(); | |
| 37 | |
| 38 bool IsTouching(); | |
|
mthiesse
2016/09/22 16:20:11
As discussed offline, we should just expose the Vr
asimjour
2016/09/22 22:55:16
Done.
| |
| 39 | |
| 40 float TouchPosX(); | |
| 41 | |
| 42 float TouchPosY(); | |
| 43 | |
| 44 // Must be called when the GL renderer gets onDrawFrame(). | |
| 45 void ProcessUpdatedGesture(VrGesture gesture); | |
| 46 // Must be called when the GL renderer gets onDrawFrame(). | |
| 47 void ProcessUpdatedUIGesture(VrGesture gesture); | |
| 48 | |
| 49 void SetContentViewCore(content::ContentViewCore* content_cvc_ptr, | |
| 50 content::ContentViewCore* ui_cvc_ptr); | |
| 51 | |
| 52 const gvr::Quatf Orientation(); | |
| 53 | |
| 54 bool IsTouchDown(); | |
| 55 bool IsTouchUp(); | |
| 56 | |
| 57 bool ButtonUp(const int32_t button); | |
| 58 bool ButtonDown(const int32_t button); | |
| 59 | |
| 60 bool IsConnected(); | |
| 61 | |
| 62 protected: | |
| 63 friend class base::RefCountedThreadSafe<VrControllerManager>; | |
| 64 virtual ~VrControllerManager(); | |
| 65 | |
| 66 private: | |
| 67 void SendGesture(VrGesture gesture, | |
| 68 content::VrInputManager* content_view_core_ptr); | |
| 69 | |
| 70 content::VrInputManager* vr_content_ptr; | |
| 71 content::VrInputManager* vr_ui_ptr; | |
| 72 std::unique_ptr<VrController> vr_controller_; | |
| 73 std::unique_ptr<gvr::ControllerApi> controller_api_; | |
| 74 }; | |
| 75 | |
| 76 } // namespace vr_shell | |
| 77 | |
| 78 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_ | |
| OLD | NEW |