| 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 "modules/vr/VRDisplay.h" | 5 #include "modules/vr/VRDisplay.h" |
| 6 | 6 |
| 7 #include "core/css/StylePropertySet.h" | 7 #include "core/css/StylePropertySet.h" |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "core/dom/DocumentUserGestureToken.h" | 9 #include "core/dom/DocumentUserGestureToken.h" |
| 10 #include "core/dom/FrameRequestCallback.h" | 10 #include "core/dom/FrameRequestCallback.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 EnumerationHistogram, vrPresentationResultHistogram, | 276 EnumerationHistogram, vrPresentationResultHistogram, |
| 277 ("VRDisplayPresentResult", | 277 ("VRDisplayPresentResult", |
| 278 static_cast<int>(PresentationResult::PresentationResultMax))); | 278 static_cast<int>(PresentationResult::PresentationResultMax))); |
| 279 vrPresentationResultHistogram.count(static_cast<int>(result)); | 279 vrPresentationResultHistogram.count(static_cast<int>(result)); |
| 280 } | 280 } |
| 281 | 281 |
| 282 ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, | 282 ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, |
| 283 const HeapVector<VRLayer>& layers) { | 283 const HeapVector<VRLayer>& layers) { |
| 284 ExecutionContext* executionContext = scriptState->getExecutionContext(); | 284 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| 285 UseCounter::count(executionContext, UseCounter::VRRequestPresent); | 285 UseCounter::count(executionContext, UseCounter::VRRequestPresent); |
| 286 String errorMessage; | 286 if (!executionContext->isSecureContext()) { |
| 287 if (!executionContext->isSecureContext(errorMessage)) { | |
| 288 UseCounter::count(executionContext, | 287 UseCounter::count(executionContext, |
| 289 UseCounter::VRRequestPresentInsecureOrigin); | 288 UseCounter::VRRequestPresentInsecureOrigin); |
| 290 } | 289 } |
| 291 | 290 |
| 292 ReportPresentationResult(PresentationResult::Requested); | 291 ReportPresentationResult(PresentationResult::Requested); |
| 293 | 292 |
| 294 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 293 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 295 ScriptPromise promise = resolver->promise(); | 294 ScriptPromise promise = resolver->promise(); |
| 296 | 295 |
| 297 // If the VRDisplay does not advertise the ability to present reject the | 296 // If the VRDisplay does not advertise the ability to present reject the |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 visitor->trace(m_stageParameters); | 769 visitor->trace(m_stageParameters); |
| 771 visitor->trace(m_eyeParametersLeft); | 770 visitor->trace(m_eyeParametersLeft); |
| 772 visitor->trace(m_eyeParametersRight); | 771 visitor->trace(m_eyeParametersRight); |
| 773 visitor->trace(m_layer); | 772 visitor->trace(m_layer); |
| 774 visitor->trace(m_renderingContext); | 773 visitor->trace(m_renderingContext); |
| 775 visitor->trace(m_scriptedAnimationController); | 774 visitor->trace(m_scriptedAnimationController); |
| 776 visitor->trace(m_pendingPresentResolvers); | 775 visitor->trace(m_pendingPresentResolvers); |
| 777 } | 776 } |
| 778 | 777 |
| 779 } // namespace blink | 778 } // namespace blink |
| OLD | NEW |