| 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 "base/memory/weak_ptr.h" | |
| 13 #include "device/vr/vr_device_provider.h" | 12 #include "device/vr/vr_device_provider.h" |
| 14 #include "device/vr/vr_export.h" | 13 #include "device/vr/vr_export.h" |
| 15 | 14 |
| 16 namespace device { | 15 namespace device { |
| 17 | 16 |
| 18 class GvrDelegate; | 17 class GvrDelegate; |
| 19 class GvrDevice; | 18 class GvrDevice; |
| 20 | 19 |
| 21 class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider { | 20 class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider { |
| 22 public: | 21 public: |
| 23 GvrDeviceProvider(); | 22 GvrDeviceProvider(); |
| 24 ~GvrDeviceProvider() override; | 23 ~GvrDeviceProvider() override; |
| 25 | 24 |
| 26 void GetDevices(std::vector<VRDevice*>* devices) override; | 25 void GetDevices(std::vector<VRDevice*>* devices) override; |
| 27 void Initialize() override; | 26 void Initialize() override; |
| 28 | 27 |
| 29 void SetListeningForActivate(bool listening) override; | 28 void SetListeningForActivate(bool listening) override; |
| 30 | 29 |
| 31 // Called from GvrDevice. | 30 // Called from GvrDevice. |
| 32 void RequestPresent(const base::Callback<void(bool)>& callback); | 31 void RequestPresent(const base::Callback<void(bool)>& callback); |
| 33 void ExitPresent(); | 32 void ExitPresent(); |
| 34 | 33 |
| 35 void OnGvrDelegateReady(const base::WeakPtr<GvrDelegate>& delegate); | 34 void OnGvrDelegateReady(GvrDelegate* delegate); |
| 36 void OnGvrDelegateRemoved(); | 35 void OnGvrDelegateRemoved(); |
| 36 |
| 37 // TODO(mthiesse): Make the NonPresentingDelegate owned by this class so that |
| 38 // it cannot be removed. |
| 39 void OnNonPresentingDelegateRemoved(); |
| 37 void OnDisplayBlur(); | 40 void OnDisplayBlur(); |
| 38 void OnDisplayFocus(); | 41 void OnDisplayFocus(); |
| 39 void OnDisplayActivate(); | 42 void OnDisplayActivate(); |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 void SwitchToNonPresentingDelegate(); | 45 void SwitchToNonPresentingDelegate(); |
| 43 | 46 |
| 44 std::unique_ptr<GvrDevice> vr_device_; | 47 std::unique_ptr<GvrDevice> vr_device_; |
| 45 | 48 |
| 46 base::WeakPtrFactory<GvrDeviceProvider> weak_ptr_factory_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); | 49 DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 } // namespace device | 52 } // namespace device |
| 52 | 53 |
| 53 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H | 54 #endif // DEVICE_VR_ANDROID_GVR_DEVICE_PROVIDER_H |
| OLD | NEW |