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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 void GvrDevice::ResetPose() { | 211 void GvrDevice::ResetPose() { |
212 gvr::GvrApi* gvr_api = GetGvrApi(); | 212 gvr::GvrApi* gvr_api = GetGvrApi(); |
213 | 213 |
214 // Should never call RecenterTracking when using with Daydream viewers. On | 214 // Should never call RecenterTracking when using with Daydream viewers. On |
215 // those devices recentering should only be done via the controller. | 215 // those devices recentering should only be done via the controller. |
216 if (gvr_api && gvr_api->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) | 216 if (gvr_api && gvr_api->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD) |
217 gvr_api->RecenterTracking(); | 217 gvr_api->RecenterTracking(); |
218 } | 218 } |
219 | 219 |
220 bool GvrDevice::RequestPresent(bool secure_origin) { | 220 void GvrDevice::RequestPresent(const base::Callback<void(bool)>& callback) { |
| 221 gvr_provider_->RequestPresent(callback); |
| 222 } |
| 223 |
| 224 void GvrDevice::SetSecureOrigin(bool secure_origin) { |
221 secure_origin_ = secure_origin; | 225 secure_origin_ = secure_origin; |
222 if (delegate_) | 226 if (delegate_) |
223 delegate_->SetWebVRSecureOrigin(secure_origin_); | 227 delegate_->SetWebVRSecureOrigin(secure_origin_); |
224 | |
225 return gvr_provider_->RequestPresent(); | |
226 } | 228 } |
227 | 229 |
228 void GvrDevice::ExitPresent() { | 230 void GvrDevice::ExitPresent() { |
229 gvr_provider_->ExitPresent(); | 231 gvr_provider_->ExitPresent(); |
230 OnExitPresent(); | 232 OnExitPresent(); |
231 } | 233 } |
232 | 234 |
233 void GvrDevice::SubmitFrame(mojom::VRPosePtr pose) { | 235 void GvrDevice::SubmitFrame(mojom::VRPosePtr pose) { |
234 if (delegate_) | 236 if (delegate_) |
235 delegate_->SubmitWebVRFrame(); | 237 delegate_->SubmitWebVRFrame(); |
(...skipping 30 matching lines...) Expand all Loading... |
266 } | 268 } |
267 | 269 |
268 gvr::GvrApi* GvrDevice::GetGvrApi() { | 270 gvr::GvrApi* GvrDevice::GetGvrApi() { |
269 if (!delegate_) | 271 if (!delegate_) |
270 return nullptr; | 272 return nullptr; |
271 | 273 |
272 return delegate_->gvr_api(); | 274 return delegate_->gvr_api(); |
273 } | 275 } |
274 | 276 |
275 } // namespace device | 277 } // namespace device |
OLD | NEW |