Index: chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc |
diff --git a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc |
index 8a095d2d74a4bf0e24f6d4b07d5977a7f08c4110..7f3a2a2df1e97cea9818c40b6ea4cb6fd6476ea1 100644 |
--- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc |
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc |
@@ -6,6 +6,7 @@ |
#include "base/callback_helpers.h" |
#include "chrome/browser/android/vr_shell/vr_shell.h" |
+#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h" |
namespace vr_shell { |
@@ -13,25 +14,17 @@ namespace { |
static constexpr long kPredictionTimeWithoutVsyncNanos = 50000000; |
} // namespace |
-NonPresentingGvrDelegate::NonPresentingGvrDelegate(long context) |
+NonPresentingGvrDelegate::NonPresentingGvrDelegate(gvr_context* context) |
: task_runner_(base::ThreadTaskRunnerHandle::Get()), |
binding_(this), |
weak_ptr_factory_(this) { |
- gvr_api_ = gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(context)); |
+ gvr_api_ = gvr::GvrApi::WrapNonOwned(context); |
} |
NonPresentingGvrDelegate::~NonPresentingGvrDelegate() { |
StopVSyncLoop(); |
} |
-gvr::Sizei NonPresentingGvrDelegate::GetWebVRCompositorSurfaceSize() { |
- return device::kInvalidRenderTargetSize; |
-} |
- |
-gvr::GvrApi* NonPresentingGvrDelegate::gvr_api() { |
- return gvr_api_.get(); |
-} |
- |
void NonPresentingGvrDelegate::OnVRVsyncProviderRequest( |
device::mojom::VRVSyncProviderRequest request) { |
binding_.Close(); |
@@ -142,4 +135,22 @@ void NonPresentingGvrDelegate::SendVSync(base::TimeDelta time, |
callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1); |
} |
+bool NonPresentingGvrDelegate::SupportsPresentation() { |
+ return false; |
+} |
+ |
+void NonPresentingGvrDelegate::ResetPose() { |
+ // Should never call RecenterTracking when using with Daydream viewers. On |
+ // those devices recentering should only be done via the controller. |
+ if (gvr_api_ && gvr_api_->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) |
+ gvr_api_->RecenterTracking(); |
+} |
+ |
+void NonPresentingGvrDelegate::CreateVRDisplayInfo( |
+ const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
+ uint32_t device_id) { |
+ callback.Run(VrShell::CreateVRDisplayInfo( |
+ gvr_api_.get(), device::kInvalidRenderTargetSize, device_id)); |
+} |
+ |
} // namespace vr_shell |