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_DEVICE_PROVIDER_H | 5 #ifndef DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H |
6 #define DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H | 6 #define DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H |
7 | 7 |
8 #include <jni.h> | |
9 | |
10 #include <memory> | 8 #include <memory> |
11 | 9 |
12 #include "base/android/jni_android.h" | |
13 #include "base/macros.h" | 10 #include "base/macros.h" |
14 #include "device/vr/android/gvr/gvr_api_manager.h" | 11 #include "device/vr/android/gvr/gvr_delegate.h" |
15 #include "device/vr/vr_device.h" | 12 #include "device/vr/vr_device.h" |
16 #include "device/vr/vr_device_provider.h" | 13 #include "device/vr/vr_device_provider.h" |
17 | 14 |
18 namespace device { | 15 namespace device { |
19 | 16 |
20 class GvrDeviceProvider : public VRDeviceProvider, public GvrApiManagerClient { | 17 class GvrDeviceProviderDelegate; |
| 18 |
| 19 class GvrDeviceProvider : public VRDeviceProvider, public GvrDelegateClient { |
21 public: | 20 public: |
22 GvrDeviceProvider(); | 21 GvrDeviceProvider(); |
23 ~GvrDeviceProvider() override; | 22 ~GvrDeviceProvider() override; |
24 | 23 |
25 void GetDevices(std::vector<VRDevice*>* devices) override; | 24 void GetDevices(std::vector<VRDevice*>* devices) override; |
26 void Initialize() override; | 25 void Initialize() override; |
27 | 26 |
28 // GvrApiManagerClient | 27 // GvrDelegateClient |
29 void OnGvrApiInitialized(gvr::GvrApi* gvr_api) override; | 28 void OnDelegateInitialized(GvrDelegate* delegate) override; |
30 void OnGvrApiShutdown() override; | 29 void OnDelegateShutdown() override; |
31 | 30 |
32 private: | 31 private: |
33 std::unique_ptr<VRDevice> vr_device_; | 32 std::unique_ptr<VRDevice> vr_device_; |
34 base::android::ScopedJavaGlobalRef<jobject> j_device_; | 33 std::unique_ptr<GvrDeviceProviderDelegate> delegate_; |
35 | 34 |
36 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); | 35 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); |
37 }; | 36 }; |
38 | 37 |
39 } // namespace device | 38 } // namespace device |
40 | 39 |
41 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H | 40 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H |
OLD | NEW |