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

Side by Side Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2662213006: Reject requestPresent requests when fullscreen is not enabled. (Closed)
Patch Set: rebase + address comment Created 3 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // allowed outside a user gesture so that the presented content may be 231 // allowed outside a user gesture so that the presented content may be
232 // updated. 232 // updated.
233 if (firstPresent && !UserGestureIndicator::utilizeUserGesture()) { 233 if (firstPresent && !UserGestureIndicator::utilizeUserGesture()) {
234 DOMException* exception = DOMException::create( 234 DOMException* exception = DOMException::create(
235 InvalidStateError, "API can only be initiated by a user gesture."); 235 InvalidStateError, "API can only be initiated by a user gesture.");
236 resolver->reject(exception); 236 resolver->reject(exception);
237 ReportPresentationResult(PresentationResult::NotInitiatedByUserGesture); 237 ReportPresentationResult(PresentationResult::NotInitiatedByUserGesture);
238 return promise; 238 return promise;
239 } 239 }
240 240
241 // TODO(mthiesse): Remove fullscreen requirement for presentation. See
242 // crbug.com/687369
243 Document* doc = this->document();
244 if (!doc || !Fullscreen::fullscreenEnabled(*doc)) {
245 DOMException* exception =
246 DOMException::create(InvalidStateError, "Fullscreen is not enabled.");
247 resolver->reject(exception);
248 ReportPresentationResult(PresentationResult::FullscreenNotEnabled);
249 return promise;
250 }
251
241 // A valid number of layers must be provided in order to present. 252 // A valid number of layers must be provided in order to present.
242 if (layers.size() == 0 || layers.size() > m_capabilities->maxLayers()) { 253 if (layers.size() == 0 || layers.size() > m_capabilities->maxLayers()) {
243 forceExitPresent(); 254 forceExitPresent();
244 DOMException* exception = 255 DOMException* exception =
245 DOMException::create(InvalidStateError, "Invalid number of layers."); 256 DOMException::create(InvalidStateError, "Invalid number of layers.");
246 resolver->reject(exception); 257 resolver->reject(exception);
247 ReportPresentationResult(PresentationResult::InvalidNumberOfLayers); 258 ReportPresentationResult(PresentationResult::InvalidNumberOfLayers);
248 return promise; 259 return promise;
249 } 260 }
250 261
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 visitor->trace(m_stageParameters); 755 visitor->trace(m_stageParameters);
745 visitor->trace(m_eyeParametersLeft); 756 visitor->trace(m_eyeParametersLeft);
746 visitor->trace(m_eyeParametersRight); 757 visitor->trace(m_eyeParametersRight);
747 visitor->trace(m_layer); 758 visitor->trace(m_layer);
748 visitor->trace(m_renderingContext); 759 visitor->trace(m_renderingContext);
749 visitor->trace(m_scriptedAnimationController); 760 visitor->trace(m_scriptedAnimationController);
750 visitor->trace(m_pendingPresentResolvers); 761 visitor->trace(m_pendingPresentResolvers);
751 } 762 }
752 763
753 } // namespace blink 764 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698