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 82c91d6629bd26a3b0d766827690be9f5bd12fe2..6961ba3758c3d5ff8b3543c63c0c2b7af7b26a9a 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; |
@@ -77,9 +77,6 @@ GvrDeviceProvider::GvrDeviceProvider() |
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
GvrDeviceProvider::~GvrDeviceProvider() { |
- GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory( |
- GAMEPAD_SOURCE_GVR); |
- |
ExitPresent(); |
} |
@@ -96,16 +93,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); |
} |
} |
@@ -123,7 +113,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) |
@@ -153,6 +146,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 |