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 DEVICE_VR_ANDROID_GVR_DELEGATE_H | 5 #ifndef DEVICE_VR_ANDROID_GVR_DELEGATE_H |
6 #define DEVICE_VR_ANDROID_GVR_DELEGATE_H | 6 #define DEVICE_VR_ANDROID_GVR_DELEGATE_H |
7 | 7 |
8 #include "device/vr/android/gvr/gvr_device_provider.h" | 8 #include "device/vr/android/gvr/gvr_device_provider.h" |
9 #include "device/vr/vr_export.h" | 9 #include "device/vr/vr_export.h" |
10 #include "device/vr/vr_service.mojom.h" | 10 #include "device/vr/vr_service.mojom.h" |
11 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 11 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
12 | 12 |
13 namespace gvr { | |
14 class GvrApi; | |
15 } // namespace gvr | |
16 | |
17 namespace device { | 13 namespace device { |
18 | 14 |
19 constexpr gvr::Sizei kInvalidRenderTargetSize = {0, 0}; | 15 constexpr gvr::Sizei kInvalidRenderTargetSize = {0, 0}; |
20 | 16 |
21 class DEVICE_VR_EXPORT GvrDelegate { | 17 class DEVICE_VR_EXPORT GvrDelegate { |
22 public: | 18 public: |
23 virtual void SetWebVRSecureOrigin(bool secure_origin) = 0; | 19 virtual void SetWebVRSecureOrigin(bool secure_origin) = 0; |
24 virtual void SubmitWebVRFrame() = 0; | 20 virtual void SubmitWebVRFrame() = 0; |
25 virtual void UpdateWebVRTextureBounds(int16_t frame_index, | 21 virtual void UpdateWebVRTextureBounds(int16_t frame_index, |
26 const gvr::Rectf& left_bounds, | 22 const gvr::Rectf& left_bounds, |
27 const gvr::Rectf& right_bounds) = 0; | 23 const gvr::Rectf& right_bounds) = 0; |
28 virtual gvr::Sizei GetWebVRCompositorSurfaceSize() = 0; | |
29 virtual void SetWebVRRenderSurfaceSize(int width, int height) = 0; | |
30 // TODO(mthiesse): This function is not threadsafe. crbug.com/674594 | |
31 virtual gvr::GvrApi* gvr_api() = 0; | |
32 virtual void OnVRVsyncProviderRequest( | 24 virtual void OnVRVsyncProviderRequest( |
33 mojom::VRVSyncProviderRequest request) = 0; | 25 mojom::VRVSyncProviderRequest request) = 0; |
34 virtual void UpdateVSyncInterval(long timebase_nanos, | 26 virtual void UpdateVSyncInterval(long timebase_nanos, |
35 double interval_seconds) = 0; | 27 double interval_seconds) = 0; |
| 28 virtual bool SupportsPresentation() = 0; |
| 29 virtual void ResetPose() = 0; |
| 30 virtual void CreateVRDisplayInfo( |
| 31 const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback, |
| 32 uint32_t device_id) = 0; |
36 | 33 |
37 protected: | 34 protected: |
38 virtual ~GvrDelegate() {} | 35 virtual ~GvrDelegate() {} |
39 }; | 36 }; |
40 | 37 |
41 class DEVICE_VR_EXPORT GvrDelegateProvider { | 38 class DEVICE_VR_EXPORT GvrDelegateProvider { |
42 public: | 39 public: |
43 static void SetInstance(GvrDelegateProvider* delegate_provider); | 40 static void SetInstance(GvrDelegateProvider* delegate_provider); |
44 static GvrDelegateProvider* GetInstance(); | 41 static GvrDelegateProvider* GetInstance(); |
45 | 42 |
46 virtual void SetDeviceProvider(GvrDeviceProvider* device_provider) = 0; | 43 virtual void SetDeviceProvider(GvrDeviceProvider* device_provider) = 0; |
| 44 virtual void ClearDeviceProvider() = 0; |
47 virtual void RequestWebVRPresent( | 45 virtual void RequestWebVRPresent( |
48 const base::Callback<void(bool)>& callback) = 0; | 46 const base::Callback<void(bool)>& callback) = 0; |
49 virtual void ExitWebVRPresent() = 0; | 47 virtual void ExitWebVRPresent() = 0; |
50 virtual GvrDelegate* GetNonPresentingDelegate() = 0; | 48 virtual GvrDelegate* GetDelegate() = 0; |
51 virtual void DestroyNonPresentingDelegate() = 0; | |
52 virtual void SetListeningForActivate(bool listening) = 0; | 49 virtual void SetListeningForActivate(bool listening) = 0; |
53 | 50 |
54 protected: | 51 protected: |
55 virtual ~GvrDelegateProvider() {} | 52 virtual ~GvrDelegateProvider() {} |
56 | 53 |
57 private: | 54 private: |
58 static GvrDelegateProvider* delegate_provider_; | 55 static GvrDelegateProvider* delegate_provider_; |
59 }; | 56 }; |
60 | 57 |
61 } // namespace device | 58 } // namespace device |
62 | 59 |
63 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H | 60 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H |
OLD | NEW |