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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 gvr_api->RecenterTracking(); | 201 gvr_api->RecenterTracking(); |
202 } | 202 } |
203 | 203 |
204 bool GvrDevice::RequestPresent(VRServiceImpl* service, bool secure_origin) { | 204 bool GvrDevice::RequestPresent(VRServiceImpl* service, bool secure_origin) { |
205 if (!IsAccessAllowed(service)) | 205 if (!IsAccessAllowed(service)) |
206 return false; | 206 return false; |
207 | 207 |
208 // One service could present on several devices at the same time | 208 // One service could present on several devices at the same time |
209 // and different service could present on different devices the same time | 209 // and different service could present on different devices the same time |
210 if (presenting_service_ == nullptr) | 210 if (presenting_service_ == nullptr) |
211 presenting_service_ = service; | 211 presenting_service_ = service; |
mthiesse
2016/11/14 16:24:12
Can we make presenting_service_ private to vr_devi
| |
212 | 212 |
213 secure_origin_ = secure_origin; | 213 secure_origin_ = secure_origin; |
214 if (delegate_) | 214 if (delegate_) |
215 delegate_->SetWebVRSecureOrigin(secure_origin_); | 215 delegate_->SetWebVRSecureOrigin(secure_origin_); |
216 | 216 |
217 return gvr_provider_->RequestPresent(); | 217 return gvr_provider_->RequestPresent(); |
218 } | 218 } |
219 | 219 |
220 void GvrDevice::ExitPresent(VRServiceImpl* service) { | 220 void GvrDevice::ExitPresent(VRServiceImpl* service) { |
221 if (IsPresentingService(service)) | 221 if (IsPresentingService(service)) { |
222 presenting_service_ = nullptr; | 222 gvr_provider_->ExitPresent(); |
223 | 223 OnExitPresent(); |
224 gvr_provider_->ExitPresent(); | 224 } |
225 OnExitPresent(service); | |
226 } | 225 } |
227 | 226 |
228 void GvrDevice::SubmitFrame(VRServiceImpl* service, mojom::VRPosePtr pose) { | 227 void GvrDevice::SubmitFrame(VRServiceImpl* service, mojom::VRPosePtr pose) { |
229 if (!IsPresentingService(service) || !delegate_) | 228 if (!IsPresentingService(service) || !delegate_) |
230 return; | 229 return; |
231 delegate_->SubmitWebVRFrame(); | 230 delegate_->SubmitWebVRFrame(); |
232 } | 231 } |
233 | 232 |
234 void GvrDevice::UpdateLayerBounds(VRServiceImpl* service, | 233 void GvrDevice::UpdateLayerBounds(VRServiceImpl* service, |
235 mojom::VRLayerBoundsPtr leftBounds, | 234 mojom::VRLayerBoundsPtr leftBounds, |
(...skipping 20 matching lines...) Expand all Loading... | |
256 } | 255 } |
257 | 256 |
258 gvr::GvrApi* GvrDevice::GetGvrApi() { | 257 gvr::GvrApi* GvrDevice::GetGvrApi() { |
259 if (!delegate_) | 258 if (!delegate_) |
260 return nullptr; | 259 return nullptr; |
261 | 260 |
262 return delegate_->gvr_api(); | 261 return delegate_->gvr_api(); |
263 } | 262 } |
264 | 263 |
265 } // namespace device | 264 } // namespace device |
OLD | NEW |