Index: device/vr/android/gvr/gvr_device_provider.cc |
diff --git a/device/vr/android/gvr/gvr_device_provider.cc b/device/vr/android/gvr/gvr_device_provider.cc |
index ce566e87c6a92eaba9f2887f2e5fcc9171dadc06..6bb73a04cc1ba7dcec4c662c4dffb3a94259250f 100644 |
--- a/device/vr/android/gvr/gvr_device_provider.cc |
+++ b/device/vr/android/gvr/gvr_device_provider.cc |
@@ -15,9 +15,9 @@ |
#include "device/vr/android/gvr/gvr_gamepad_data_fetcher.h" |
#include "device/vr/vr_device_manager.h" |
#include "jni/GvrDeviceProvider_jni.h" |
-#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr.h" |
-#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr_controller.h" |
-#include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/gvr_types.h" |
+#include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h" |
+#include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_controller.h" |
+#include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_types.h" |
using base::android::AttachCurrentThread; |
using base::android::GetApplicationContext; |
@@ -78,9 +78,6 @@ GvrDeviceProvider::GvrDeviceProvider() |
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
GvrDeviceProvider::~GvrDeviceProvider() { |
- GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory( |
- GAMEPAD_SOURCE_GVR); |
- |
ExitPresent(); |
} |
@@ -97,16 +94,9 @@ void GvrDeviceProvider::SetClient(VRClientDispatcher* client) { |
} |
void GvrDeviceProvider::Initialize() { |
- if (!non_presenting_delegate_) { |
- non_presenting_delegate_.reset(new GvrNonPresentingDelegate()); |
- if (non_presenting_delegate_->gvr_api()) { |
- vr_device_.reset(new GvrDevice(this, non_presenting_delegate_.get())); |
- client_->OnDeviceConnectionStatusChanged(vr_device_.get(), true); |
- |
- GamepadDataFetcherManager::GetInstance()->AddFactory( |
- new GvrGamepadDataFetcher::Factory(non_presenting_delegate_.get(), |
- vr_device_->id())); |
- } |
+ if (!vr_device_) { |
+ vr_device_.reset(new GvrDevice(this, nullptr)); |
+ client_->OnDeviceConnectionStatusChanged(vr_device_.get(), true); |
} |
} |
@@ -124,7 +114,10 @@ void GvrDeviceProvider::ExitPresent() { |
if (!vr_device_) |
return; |
- vr_device_->SetDelegate(non_presenting_delegate_.get()); |
+ vr_device_->SetDelegate(nullptr); |
+ |
+ GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory( |
+ GAMEPAD_SOURCE_GVR); |
GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance(); |
if (delegate_provider) |
@@ -154,6 +147,8 @@ void GvrDeviceProvider::GvrDelegateReady(GvrDelegate* delegate) { |
DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
vr_device_->SetDelegate(delegate); |
+ GamepadDataFetcherManager::GetInstance()->AddFactory( |
+ new GvrGamepadDataFetcher::Factory(delegate, vr_device_->id())); |
} |
} // namespace device |