Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(951)

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2543723002: Add switch to disable WebVR gesture requirement
Patch Set: Addressed ddorwin@'s naming comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..befadaa2f81e49ede2cf0e99227720701fd85fda 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 gestureRequired =
+ RuntimeEnabledFeatures::webVrRequiresUserGestureEnabled();
// 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() &&
+ gestureRequired) {
DOMException* exception = DOMException::create(
InvalidStateError, "API can only be initiated by a user gesture.");
resolver->reject(exception);

Powered by Google App Engine
This is Rietveld 408576698