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 DEVICE_VR_ANDROID_GVR_DELEGATE_H |
| 6 #define DEVICE_VR_ANDROID_GVR_DELEGATE_H |
| 7 |
| 8 #include "device/vr/vr_export.h" |
| 9 |
| 10 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr.h" |
| 11 |
| 12 namespace base { |
| 13 template <typename Type> |
| 14 struct DefaultSingletonTraits; |
| 15 } // namespace base |
| 16 |
| 17 namespace device { |
| 18 |
| 19 class DEVICE_VR_EXPORT GvrDelegate { |
| 20 public: |
| 21 virtual void RequestWebVRPresent() = 0; |
| 22 virtual void ExitWebVRPresent() = 0; |
| 23 |
| 24 virtual void SubmitWebVRFrame() = 0; |
| 25 virtual void UpdateWebVRTextureBounds(int eye, |
| 26 float left, |
| 27 float top, |
| 28 float width, |
| 29 float height) = 0; |
| 30 |
| 31 virtual gvr::GvrApi* gvr_api() = 0; |
| 32 }; |
| 33 |
| 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 |
| 65 |
| 66 #endif // DEVICE_VR_ANDROID_GVR_DELEGATE_H |
OLD | NEW |