| 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/macros.h" | 10 #include "base/macros.h" |
| 11 #include "device/vr/android/gvr/gvr_delegate.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "device/vr/vr_client_dispatcher.h" | 12 #include "device/vr/vr_client_dispatcher.h" |
| 13 #include "device/vr/vr_device.h" | 13 #include "device/vr/vr_device.h" |
| 14 #include "device/vr/vr_device_provider.h" | 14 #include "device/vr/vr_device_provider.h" |
| 15 #include "device/vr/vr_export.h" |
| 15 | 16 |
| 16 namespace device { | 17 namespace device { |
| 17 | 18 |
| 18 class GvrDeviceProviderDelegate; | 19 class GvrDelegate; |
| 20 class GvrDevice; |
| 21 class GvrNonPresentingDelegate; |
| 19 | 22 |
| 20 class GvrDeviceProvider : public VRDeviceProvider, public GvrDelegateClient { | 23 class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider { |
| 21 public: | 24 public: |
| 22 GvrDeviceProvider(); | 25 GvrDeviceProvider(); |
| 23 ~GvrDeviceProvider() override; | 26 ~GvrDeviceProvider() override; |
| 24 | 27 |
| 25 void GetDevices(std::vector<VRDevice*>* devices) override; | 28 void GetDevices(std::vector<VRDevice*>* devices) override; |
| 26 void Initialize() override; | 29 void Initialize() override; |
| 27 | 30 |
| 28 // GvrDelegateClient | 31 // Called from GvrDevice |
| 29 void OnDelegateInitialized(GvrDelegate* delegate) override; | 32 bool RequestPresent(); |
| 30 void OnDelegateShutdown() override; | 33 void ExitPresent(); |
| 34 |
| 35 // Called from GvrDelegate |
| 36 void OnGvrDelegateReady(GvrDelegate* delegate); |
| 37 void OnGvrDelegateRemoved(); |
| 31 | 38 |
| 32 void SetClient(VRClientDispatcher* client) override; | 39 void SetClient(VRClientDispatcher* client) override; |
| 33 | 40 |
| 34 private: | 41 private: |
| 42 void GvrDelegateReady(GvrDelegate* delegate); |
| 43 void GvrDelegateRemoved(); |
| 44 |
| 35 std::unique_ptr<VRClientDispatcher> client_; | 45 std::unique_ptr<VRClientDispatcher> client_; |
| 36 std::unique_ptr<VRDevice> vr_device_; | 46 std::unique_ptr<GvrDevice> vr_device_; |
| 37 std::unique_ptr<GvrDeviceProviderDelegate> delegate_; | 47 std::unique_ptr<GvrNonPresentingDelegate> non_presenting_delegate_; |
| 48 |
| 49 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 38 | 50 |
| 39 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); | 51 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); |
| 40 }; | 52 }; |
| 41 | 53 |
| 42 } // namespace device | 54 } // namespace device |
| 43 | 55 |
| 44 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H | 56 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H |
| OLD | NEW |