| 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/vr_export.h" | 9 #include "device/vr/vr_export.h" |
| 9 | 10 |
| 10 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr.h" | 11 namespace gvr { |
| 11 | 12 class GvrApi; |
| 12 namespace base { | 13 } // namespace gvr |
| 13 template <typename Type> | |
| 14 struct DefaultSingletonTraits; | |
| 15 } // namespace base | |
| 16 | 14 |
| 17 namespace device { | 15 namespace device { |
| 18 | 16 |
| 17 class DEVICE_VR_EXPORT GvrDelegateProvider { |
| 18 public: |
| 19 static void SetInstance(GvrDelegateProvider* delegate_provider); |
| 20 static GvrDelegateProvider* GetInstance(); |
| 21 |
| 22 virtual bool RequestWebVRPresent(GvrDeviceProvider* device_provider) = 0; |
| 23 virtual void ExitWebVRPresent() = 0; |
| 24 |
| 25 private: |
| 26 static GvrDelegateProvider* delegate_provider_; |
| 27 }; |
| 28 |
| 19 class DEVICE_VR_EXPORT GvrDelegate { | 29 class DEVICE_VR_EXPORT GvrDelegate { |
| 20 public: | 30 public: |
| 21 virtual void RequestWebVRPresent() = 0; | |
| 22 virtual void ExitWebVRPresent() = 0; | |
| 23 | |
| 24 virtual void SubmitWebVRFrame() = 0; | 31 virtual void SubmitWebVRFrame() = 0; |
| 25 virtual void UpdateWebVRTextureBounds(int eye, | 32 virtual void UpdateWebVRTextureBounds(int eye, |
| 26 float left, | 33 float left, |
| 27 float top, | 34 float top, |
| 28 float width, | 35 float width, |
| 29 float height) = 0; | 36 float height) = 0; |
| 30 | 37 |
| 31 virtual gvr::GvrApi* gvr_api() = 0; | 38 virtual gvr::GvrApi* gvr_api() = 0; |
| 32 }; | 39 }; |
| 33 | 40 |
| 34 class DEVICE_VR_EXPORT GvrDelegateClient { | |
| 35 public: | |
| 36 virtual void OnDelegateInitialized(GvrDelegate* delegate) = 0; | |
| 37 virtual void OnDelegateShutdown() = 0; | |
| 38 }; | |
| 39 | |
| 40 class DEVICE_VR_EXPORT GvrDelegateManager { | |
| 41 public: | |
| 42 static GvrDelegateManager* GetInstance(); | |
| 43 | |
| 44 void AddClient(GvrDelegateClient* client); | |
| 45 void RemoveClient(GvrDelegateClient* client); | |
| 46 | |
| 47 void Initialize(GvrDelegate* delegate); | |
| 48 void Shutdown(); | |
| 49 | |
| 50 GvrDelegate* delegate() { return delegate_; } | |
| 51 | |
| 52 private: | |
| 53 friend struct base::DefaultSingletonTraits<GvrDelegateManager>; | |
| 54 | |
| 55 GvrDelegateManager(); | |
| 56 ~GvrDelegateManager(); | |
| 57 | |
| 58 GvrDelegate* delegate_; | |
| 59 | |
| 60 using ClientList = std::vector<GvrDelegateClient*>; | |
| 61 ClientList clients_; | |
| 62 }; | |
| 63 | |
| 64 } // namespace device | 41 } // namespace device |
| 65 | 42 |
| 66 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H | 43 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H |
| OLD | NEW |