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 "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "device/vr/android/gvr/gvr_device_provider.h" | 9 #include "device/vr/android/gvr/gvr_device_provider.h" |
10 #include "device/vr/vr_export.h" | 10 #include "device/vr/vr_export.h" |
11 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty
pes.h" | 11 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_ty
pes.h" |
12 | 12 |
13 namespace gvr { | 13 namespace gvr { |
14 class GvrApi; | 14 class GvrApi; |
15 } // namespace gvr | 15 } // namespace gvr |
16 | 16 |
17 namespace device { | 17 namespace device { |
18 | 18 |
19 class DEVICE_VR_EXPORT GvrDelegate { | 19 class DEVICE_VR_EXPORT GvrDelegate { |
20 public: | 20 public: |
21 virtual void SetWebVRSecureOrigin(bool secure_origin) = 0; | 21 virtual void SetWebVRSecureOrigin(bool secure_origin) = 0; |
22 virtual void SubmitWebVRFrame() = 0; | 22 virtual void SubmitWebVRFrame() = 0; |
23 virtual void UpdateWebVRTextureBounds(int eye, | 23 virtual void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, |
24 float left, | 24 const gvr::Rectf& right_bounds) = 0; |
25 float top, | 25 |
26 float width, | |
27 float height) = 0; | |
28 virtual void SetGvrPoseForWebVr(const gvr::Mat4f& pose, | 26 virtual void SetGvrPoseForWebVr(const gvr::Mat4f& pose, |
29 uint32_t pose_index) = 0; | 27 uint32_t pose_index) = 0; |
30 virtual gvr::GvrApi* gvr_api() = 0; | 28 virtual gvr::GvrApi* gvr_api() = 0; |
31 }; | 29 }; |
32 | 30 |
33 class DEVICE_VR_EXPORT GvrDelegateProvider { | 31 class DEVICE_VR_EXPORT GvrDelegateProvider { |
34 public: | 32 public: |
35 static void SetInstance(GvrDelegateProvider* delegate_provider); | 33 static void SetInstance(GvrDelegateProvider* delegate_provider); |
36 static GvrDelegateProvider* GetInstance(); | 34 static GvrDelegateProvider* GetInstance(); |
37 | 35 |
38 virtual bool RequestWebVRPresent( | 36 virtual bool RequestWebVRPresent( |
39 base::WeakPtr<GvrDeviceProvider> device_provider) = 0; | 37 base::WeakPtr<GvrDeviceProvider> device_provider) = 0; |
40 virtual void ExitWebVRPresent() = 0; | 38 virtual void ExitWebVRPresent() = 0; |
41 virtual base::WeakPtr<GvrDelegate> GetNonPresentingDelegate() = 0; | 39 virtual base::WeakPtr<GvrDelegate> GetNonPresentingDelegate() = 0; |
42 virtual void DestroyNonPresentingDelegate() = 0; | 40 virtual void DestroyNonPresentingDelegate() = 0; |
43 | 41 |
44 private: | 42 private: |
45 static GvrDelegateProvider* delegate_provider_; | 43 static GvrDelegateProvider* delegate_provider_; |
46 }; | 44 }; |
47 | 45 |
48 } // namespace device | 46 } // namespace device |
49 | 47 |
50 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H | 48 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H |
OLD | NEW |