Chromium Code Reviews| Index: chrome/browser/android/vr_shell/vr_controller_manager.h |
| diff --git a/chrome/browser/android/vr_shell/vr_controller_manager.h b/chrome/browser/android/vr_shell/vr_controller_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2d95501fd08cfbb97c47190d1a2104089e31ec6c |
| --- /dev/null |
| +++ b/chrome/browser/android/vr_shell/vr_controller_manager.h |
| @@ -0,0 +1,78 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_ |
| +#define CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/task_runner_util.h" |
| +#include "chrome/browser/android/vr_shell/vr_controller.h" |
| +#include "chrome/browser/android/vr_shell/vr_gesture.h" |
| +#include "content/public/browser/android/content_view_core.h" |
| +#include "content/public/browser/android/vr_input_manager.h" |
| +#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr.h" |
| +#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr_controller.h" |
| +#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr_types.h" |
| + |
| +namespace vr_shell { |
| + |
| +class VrControllerManager |
| + : public base::RefCountedThreadSafe<VrControllerManager> { |
| + public: |
| + // Controller API entry point. |
| + VrControllerManager(); |
| + |
| + // Must be called when the Activity gets onResume(). |
| + void OnResume(); |
| + |
| + // Must be called when the Activity gets onPause(). |
| + void OnPause(); |
| + |
| + // Must be called when the GL renderer gets onSurfaceCreated(). |
| + void Initialize(gvr_context_* gvr_context); |
| + |
| + // Must be called when the GL renderer gets onDrawFrame(). |
| + VrGesture Update(); |
| + |
| + 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.
|
| + |
| + float TouchPosX(); |
| + |
| + float TouchPosY(); |
| + |
| + // Must be called when the GL renderer gets onDrawFrame(). |
| + void ProcessUpdatedGesture(VrGesture gesture); |
| + // Must be called when the GL renderer gets onDrawFrame(). |
| + void ProcessUpdatedUIGesture(VrGesture gesture); |
| + |
| + void SetContentViewCore(content::ContentViewCore* content_cvc_ptr, |
| + content::ContentViewCore* ui_cvc_ptr); |
| + |
| + const gvr::Quatf Orientation(); |
| + |
| + bool IsTouchDown(); |
| + bool IsTouchUp(); |
| + |
| + bool ButtonUp(const int32_t button); |
| + bool ButtonDown(const int32_t button); |
| + |
| + bool IsConnected(); |
| + |
| + protected: |
| + friend class base::RefCountedThreadSafe<VrControllerManager>; |
| + virtual ~VrControllerManager(); |
| + |
| + private: |
| + void SendGesture(VrGesture gesture, |
| + content::VrInputManager* content_view_core_ptr); |
| + |
| + content::VrInputManager* vr_content_ptr; |
| + content::VrInputManager* vr_ui_ptr; |
| + std::unique_ptr<VrController> vr_controller_; |
| + std::unique_ptr<gvr::ControllerApi> controller_api_; |
| +}; |
| + |
| +} // namespace vr_shell |
| + |
| +#endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_MANAGER_H_ |