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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "device/vr/vr_device_provider.h" | 12 #include "device/vr/vr_device_provider.h" |
13 #include "device/vr/vr_export.h" | 13 #include "device/vr/vr_export.h" |
14 #include "device/vr/vr_service.mojom.h" | |
15 | 14 |
16 namespace device { | 15 namespace device { |
17 | 16 |
18 class GvrDelegateProvider; | |
19 class GvrDevice; | 17 class GvrDevice; |
20 | 18 |
21 class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider { | 19 class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider { |
22 public: | 20 public: |
23 GvrDeviceProvider(); | 21 GvrDeviceProvider(); |
24 ~GvrDeviceProvider() override; | 22 ~GvrDeviceProvider() override; |
25 | 23 |
26 void GetDevices(std::vector<VRDevice*>* devices) override; | 24 void GetDevices(std::vector<VRDevice*>* devices) override; |
27 void Initialize() override; | 25 void Initialize() override; |
28 | 26 |
29 void SetListeningForActivate(bool listening) override; | 27 void SetListeningForActivate(bool listening) override; |
30 | 28 |
31 // Called from GvrDevice. | 29 // Called from GvrDevice. |
32 void RequestPresent(mojom::VRSubmitFrameClientPtr submit_client, | 30 void RequestPresent(const base::Callback<void(bool)>& callback); |
33 const base::Callback<void(bool)>& callback); | |
34 void ExitPresent(); | 31 void ExitPresent(); |
35 | 32 |
36 device::GvrDelegateProvider* GetDelegateProvider(); | |
37 | |
38 GvrDevice* Device() { return vr_device_.get(); } | 33 GvrDevice* Device() { return vr_device_.get(); } |
39 | 34 |
40 private: | 35 private: |
41 void Initialize(device::GvrDelegateProvider* provider); | |
42 std::unique_ptr<GvrDevice> vr_device_; | 36 std::unique_ptr<GvrDevice> vr_device_; |
| 37 bool initialized_ = false; |
43 | 38 |
44 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); | 39 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); |
45 }; | 40 }; |
46 | 41 |
47 } // namespace device | 42 } // namespace device |
48 | 43 |
49 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H | 44 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H |
OLD | NEW |