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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 | 178 |
179 return pose; | 179 return pose; |
180 } | 180 } |
181 | 181 |
182 void GvrDevice::ResetPose() { | 182 void GvrDevice::ResetPose() { |
183 gvr::GvrApi* gvr_api = GetGvrApi(); | 183 gvr::GvrApi* gvr_api = GetGvrApi(); |
184 if (gvr_api) | 184 if (gvr_api) |
185 gvr_api->ResetTracking(); | 185 gvr_api->ResetTracking(); |
186 } | 186 } |
187 | 187 |
188 bool GvrDevice::RequestPresent() { | 188 bool GvrDevice::RequestPresent(bool secure_origin) { |
189 LOG(ERROR) << "GvrDevice::RequestPresent: " << secure_origin; | |
bshe
2016/09/29 12:46:47
Do you still need this log message?
| |
190 secure_origin_ = secure_origin; | |
191 if (delegate_) | |
192 delegate_->SetWebVRSecureOrigin(secure_origin_); | |
189 return gvr_provider_->RequestPresent(); | 193 return gvr_provider_->RequestPresent(); |
190 } | 194 } |
191 | 195 |
192 void GvrDevice::ExitPresent() { | 196 void GvrDevice::ExitPresent() { |
193 gvr_provider_->ExitPresent(); | 197 gvr_provider_->ExitPresent(); |
194 } | 198 } |
195 | 199 |
196 void GvrDevice::SubmitFrame(VRPosePtr pose) { | 200 void GvrDevice::SubmitFrame(VRPosePtr pose) { |
197 if (delegate_) | 201 if (delegate_) |
198 delegate_->SubmitWebVRFrame(); | 202 delegate_->SubmitWebVRFrame(); |
199 } | 203 } |
200 | 204 |
201 void GvrDevice::UpdateLayerBounds(VRLayerBoundsPtr leftBounds, | 205 void GvrDevice::UpdateLayerBounds(VRLayerBoundsPtr leftBounds, |
202 VRLayerBoundsPtr rightBounds) { | 206 VRLayerBoundsPtr rightBounds) { |
203 if (!delegate_) | 207 if (!delegate_) |
204 return; | 208 return; |
205 | 209 |
206 delegate_->UpdateWebVRTextureBounds(0, // Left eye | 210 delegate_->UpdateWebVRTextureBounds(0, // Left eye |
207 leftBounds->left, leftBounds->top, | 211 leftBounds->left, leftBounds->top, |
208 leftBounds->width, leftBounds->height); | 212 leftBounds->width, leftBounds->height); |
209 delegate_->UpdateWebVRTextureBounds(1, // Right eye | 213 delegate_->UpdateWebVRTextureBounds(1, // Right eye |
210 rightBounds->left, rightBounds->top, | 214 rightBounds->left, rightBounds->top, |
211 rightBounds->width, rightBounds->height); | 215 rightBounds->width, rightBounds->height); |
212 } | 216 } |
213 | 217 |
214 void GvrDevice::SetDelegate(GvrDelegate* delegate) { | 218 void GvrDevice::SetDelegate(GvrDelegate* delegate) { |
215 delegate_ = delegate; | 219 delegate_ = delegate; |
216 | 220 |
217 // Notify the clients that this device has changed | 221 // Notify the clients that this device has changed |
218 if (delegate_) | 222 if (delegate_) { |
223 delegate_->SetWebVRSecureOrigin(secure_origin_); | |
219 VRDeviceManager::GetInstance()->OnDeviceChanged(GetVRDevice()); | 224 VRDeviceManager::GetInstance()->OnDeviceChanged(GetVRDevice()); |
225 } | |
220 } | 226 } |
221 | 227 |
222 gvr::GvrApi* GvrDevice::GetGvrApi() { | 228 gvr::GvrApi* GvrDevice::GetGvrApi() { |
223 if (!delegate_) | 229 if (!delegate_) |
224 return nullptr; | 230 return nullptr; |
225 | 231 |
226 return delegate_->gvr_api(); | 232 return delegate_->gvr_api(); |
227 } | 233 } |
228 | 234 |
229 } // namespace device | 235 } // namespace device |
OLD | NEW |