Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: device/vr/android/gvr/gvr_device_provider.cc

Issue 2377763003: Revert "Updated to GVR 1.0 SDK" (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.h ('k') | device/vr/android/gvr/gvr_gamepad_data_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6961ba3758c3d5ff8b3543c63c0c2b7af7b26a9a..82c91d6629bd26a3b0d766827690be9f5bd12fe2 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/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"
+#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"
using base::android::AttachCurrentThread;
using base::android::GetApplicationContext;
@@ -77,6 +77,9 @@ GvrDeviceProvider::GvrDeviceProvider()
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
GvrDeviceProvider::~GvrDeviceProvider() {
+ GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
+ GAMEPAD_SOURCE_GVR);
+
ExitPresent();
}
@@ -93,9 +96,16 @@ void GvrDeviceProvider::SetClient(VRClientDispatcher* client) {
}
void GvrDeviceProvider::Initialize() {
- if (!vr_device_) {
- vr_device_.reset(new GvrDevice(this, nullptr));
- client_->OnDeviceConnectionStatusChanged(vr_device_.get(), true);
+ 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()));
+ }
}
}
@@ -113,10 +123,7 @@ void GvrDeviceProvider::ExitPresent() {
if (!vr_device_)
return;
- vr_device_->SetDelegate(nullptr);
-
- GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
- GAMEPAD_SOURCE_GVR);
+ vr_device_->SetDelegate(non_presenting_delegate_.get());
GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance();
if (delegate_provider)
@@ -146,8 +153,6 @@ 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
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.h ('k') | device/vr/android/gvr/gvr_gamepad_data_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698