Chromium Code Reviews| Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
| diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
| index a266f43d9b194bc884955d27c1c2187d10041e79..6c9492196984f82042fd1609544da1b5dd527ff8 100644 |
| --- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
| +++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
| @@ -23,6 +23,7 @@ |
| #include "modules/vr/VRStageParameters.h" |
| #include "modules/webgl/WebGLRenderingContextBase.h" |
| #include "platform/Histogram.h" |
| +#include "platform/RuntimeEnabledFeatures.h" |
| #include "platform/UserGestureIndicator.h" |
| #include "public/platform/Platform.h" |
| #include "wtf/AutoReset.h" |
| @@ -274,12 +275,15 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, |
| } |
| bool firstPresent = !m_isPresenting; |
| + bool gesturesEnabled = |
|
ddorwin
2016/12/01 00:03:10
gestureRequired would be better.
bsheedy
2016/12/01 00:11:57
Done.
|
| + RuntimeEnabledFeatures::webVrRequiresUserGesturesEnabled(); |
| // Initiating VR presentation is only allowed in response to a user gesture. |
| // If the VRDisplay is already presenting, however, repeated calls are |
| // allowed outside a user gesture so that the presented content may be |
| // updated. |
| - if (firstPresent && !UserGestureIndicator::utilizeUserGesture()) { |
| + if (firstPresent && !UserGestureIndicator::utilizeUserGesture() && |
| + gesturesEnabled) { |
| DOMException* exception = DOMException::create( |
| InvalidStateError, "API can only be initiated by a user gesture."); |
| resolver->reject(exception); |