| 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/FrameRequestCallback.h" | 9 #include "core/dom/FrameRequestCallback.h" |
| 10 #include "core/dom/ScriptedAnimationController.h" | 10 #include "core/dom/ScriptedAnimationController.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 ReportPresentationResult(PresentationResult::kVRDisplayCannotPresent); | 199 ReportPresentationResult(PresentationResult::kVRDisplayCannotPresent); |
| 200 return promise; | 200 return promise; |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool first_present = !is_presenting_; | 203 bool first_present = !is_presenting_; |
| 204 | 204 |
| 205 // Initiating VR presentation is only allowed in response to a user gesture. | 205 // Initiating VR presentation is only allowed in response to a user gesture. |
| 206 // If the VRDisplay is already presenting, however, repeated calls are | 206 // If the VRDisplay is already presenting, however, repeated calls are |
| 207 // allowed outside a user gesture so that the presented content may be | 207 // allowed outside a user gesture so that the presented content may be |
| 208 // updated. | 208 // updated. |
| 209 if (first_present && !UserGestureIndicator::UtilizeUserGesture() && | 209 if (first_present && !UserGestureIndicator::ProcessingUserGesture() && |
| 210 !in_display_activate_) { | 210 !in_display_activate_) { |
| 211 DOMException* exception = DOMException::Create( | 211 DOMException* exception = DOMException::Create( |
| 212 kInvalidStateError, "API can only be initiated by a user gesture."); | 212 kInvalidStateError, "API can only be initiated by a user gesture."); |
| 213 resolver->Reject(exception); | 213 resolver->Reject(exception); |
| 214 ReportPresentationResult(PresentationResult::kNotInitiatedByUserGesture); | 214 ReportPresentationResult(PresentationResult::kNotInitiatedByUserGesture); |
| 215 return promise; | 215 return promise; |
| 216 } | 216 } |
| 217 | 217 |
| 218 // A valid number of layers must be provided in order to present. | 218 // A valid number of layers must be provided in order to present. |
| 219 if (layers.size() == 0 || layers.size() > capabilities_->maxLayers()) { | 219 if (layers.size() == 0 || layers.size() > capabilities_->maxLayers()) { |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 visitor->Trace(stage_parameters_); | 813 visitor->Trace(stage_parameters_); |
| 814 visitor->Trace(eye_parameters_left_); | 814 visitor->Trace(eye_parameters_left_); |
| 815 visitor->Trace(eye_parameters_right_); | 815 visitor->Trace(eye_parameters_right_); |
| 816 visitor->Trace(layer_); | 816 visitor->Trace(layer_); |
| 817 visitor->Trace(rendering_context_); | 817 visitor->Trace(rendering_context_); |
| 818 visitor->Trace(scripted_animation_controller_); | 818 visitor->Trace(scripted_animation_controller_); |
| 819 visitor->Trace(pending_present_resolvers_); | 819 visitor->Trace(pending_present_resolvers_); |
| 820 } | 820 } |
| 821 | 821 |
| 822 } // namespace blink | 822 } // namespace blink |
| OLD | NEW |