| 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 #include "device/vr/android/gvr/gvr_device.h" | 5 #include "device/vr/android/gvr/gvr_device.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 void GvrDevice::ResetPose() { | 194 void GvrDevice::ResetPose() { |
| 195 gvr::GvrApi* gvr_api = GetGvrApi(); | 195 gvr::GvrApi* gvr_api = GetGvrApi(); |
| 196 | 196 |
| 197 // Should never call RecenterTracking when using with Daydream viewers. On | 197 // Should never call RecenterTracking when using with Daydream viewers. On |
| 198 // those devices recentering should only be done via the controller. | 198 // those devices recentering should only be done via the controller. |
| 199 if (gvr_api && gvr_api->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) | 199 if (gvr_api && gvr_api->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) |
| 200 gvr_api->RecenterTracking(); | 200 gvr_api->RecenterTracking(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool GvrDevice::RequestPresent(bool secure_origin) { | 203 void GvrDevice::RequestPresent(const base::Callback<void(bool)>& callback) { |
| 204 gvr_provider_->RequestPresent(callback); |
| 205 } |
| 206 |
| 207 void GvrDevice::SetSecureOrigin(bool secure_origin) { |
| 204 secure_origin_ = secure_origin; | 208 secure_origin_ = secure_origin; |
| 205 if (delegate_) | 209 if (delegate_) |
| 206 delegate_->SetWebVRSecureOrigin(secure_origin_); | 210 delegate_->SetWebVRSecureOrigin(secure_origin_); |
| 207 | |
| 208 return gvr_provider_->RequestPresent(); | |
| 209 } | 211 } |
| 210 | 212 |
| 211 void GvrDevice::ExitPresent() { | 213 void GvrDevice::ExitPresent() { |
| 212 gvr_provider_->ExitPresent(); | 214 gvr_provider_->ExitPresent(); |
| 213 OnExitPresent(); | 215 OnExitPresent(); |
| 214 } | 216 } |
| 215 | 217 |
| 216 void GvrDevice::SubmitFrame(mojom::VRPosePtr pose) { | 218 void GvrDevice::SubmitFrame(mojom::VRPosePtr pose) { |
| 217 if (delegate_) | 219 if (delegate_) |
| 218 delegate_->SubmitWebVRFrame(); | 220 delegate_->SubmitWebVRFrame(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 249 } | 251 } |
| 250 | 252 |
| 251 gvr::GvrApi* GvrDevice::GetGvrApi() { | 253 gvr::GvrApi* GvrDevice::GetGvrApi() { |
| 252 if (!delegate_) | 254 if (!delegate_) |
| 253 return nullptr; | 255 return nullptr; |
| 254 | 256 |
| 255 return delegate_->gvr_api(); | 257 return delegate_->gvr_api(); |
| 256 } | 258 } |
| 257 | 259 |
| 258 } // namespace device | 260 } // namespace device |
| OLD | NEW |