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..fdab47832ff4e63080185115ad6ffd7259786861 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 gesturesDisabled = |
| + RuntimeEnabledFeatures::webVrGesturesDisabledEnabled(); |
|
bokan
2016/11/30 22:29:11
Perhaps a better name might be webVrWithoutUserGes
bsheedy
2016/11/30 22:45:29
Done.
|
| // 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() && |
| + !gesturesDisabled) { |
| DOMException* exception = DOMException::create( |
| InvalidStateError, "API can only be initiated by a user gesture."); |
| resolver->reject(exception); |