| 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 "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.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 #include "device/vr/vr_export.h" |
| 16 | 16 |
| 17 namespace device { | 17 namespace device { |
| 18 | 18 |
| 19 class GvrDelegateProvider; |
| 19 class GvrDelegate; | 20 class GvrDelegate; |
| 20 class GvrDevice; | 21 class GvrDevice; |
| 21 class VRServiceImpl; | 22 class VRServiceImpl; |
| 22 | 23 |
| 23 class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider { | 24 class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider { |
| 24 public: | 25 public: |
| 25 GvrDeviceProvider(); | 26 GvrDeviceProvider(); |
| 26 ~GvrDeviceProvider() override; | 27 ~GvrDeviceProvider() override; |
| 27 | 28 |
| 28 void GetDevices(std::vector<VRDevice*>* devices) override; | 29 void GetDevices(std::vector<VRDevice*>* devices) override; |
| 29 void Initialize() override; | 30 void Initialize() override; |
| 30 | 31 |
| 31 // Called from GvrDevice. | 32 // Called from GvrDevice. |
| 32 bool RequestPresent(); | 33 bool RequestPresent(); |
| 33 void ExitPresent(); | 34 void ExitPresent(); |
| 34 | 35 |
| 35 void OnGvrDelegateReady(const base::WeakPtr<GvrDelegate>& delegate); | 36 void OnGvrDelegateReady(const base::WeakPtr<GvrDelegate>& delegate); |
| 36 void OnGvrDelegateRemoved(); | 37 void OnGvrDelegateRemoved(); |
| 37 void OnDisplayBlur(); | 38 void OnDisplayBlur(); |
| 38 void OnDisplayFocus(); | 39 void OnDisplayFocus(); |
| 39 | 40 |
| 40 private: | 41 private: |
| 42 void SwitchToNonPresentingDelegate(); |
| 43 |
| 41 std::unique_ptr<GvrDevice> vr_device_; | 44 std::unique_ptr<GvrDevice> vr_device_; |
| 42 | 45 |
| 43 base::WeakPtrFactory<GvrDeviceProvider> weak_ptr_factory_; | 46 base::WeakPtrFactory<GvrDeviceProvider> weak_ptr_factory_; |
| 44 | 47 |
| 45 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); | 48 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 } // namespace device | 51 } // namespace device |
| 49 | 52 |
| 50 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H | 53 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H |
| OLD | NEW |