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

Side by Side Diff: third_party/WebKit/Source/modules/vr/NavigatorVR.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 | « no previous file | third_party/WebKit/Source/modules/vr/VRDisplay.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/NavigatorVR.h" 5 #include "modules/vr/NavigatorVR.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/DocumentUserGestureToken.h" 10 #include "core/dom/DocumentUserGestureToken.h"
11 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
12 #include "core/dom/Fullscreen.h"
12 #include "core/frame/LocalDOMWindow.h" 13 #include "core/frame/LocalDOMWindow.h"
13 #include "core/frame/LocalFrame.h" 14 #include "core/frame/LocalFrame.h"
14 #include "core/frame/Navigator.h" 15 #include "core/frame/Navigator.h"
15 #include "core/frame/UseCounter.h" 16 #include "core/frame/UseCounter.h"
16 #include "core/page/Page.h" 17 #include "core/page/Page.h"
17 #include "modules/vr/VRController.h" 18 #include "modules/vr/VRController.h"
18 #include "modules/vr/VRDisplay.h" 19 #include "modules/vr/VRDisplay.h"
19 #include "modules/vr/VRGetDevicesCallback.h" 20 #include "modules/vr/VRGetDevicesCallback.h"
20 #include "modules/vr/VRPose.h" 21 #include "modules/vr/VRPose.h"
21 #include "platform/UserGestureIndicator.h" 22 #include "platform/UserGestureIndicator.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (!page()) 126 if (!page())
126 return; 127 return;
127 if (m_controller) { 128 if (m_controller) {
128 m_controller->setListeningForActivate(page()->isPageVisible() && 129 m_controller->setListeningForActivate(page()->isPageVisible() &&
129 m_listeningForActivate); 130 m_listeningForActivate);
130 } 131 }
131 } 132 }
132 133
133 void NavigatorVR::didAddEventListener(LocalDOMWindow* window, 134 void NavigatorVR::didAddEventListener(LocalDOMWindow* window,
134 const AtomicString& eventType) { 135 const AtomicString& eventType) {
135 if (eventType == EventTypeNames::vrdisplayactivate) { 136 // TODO(mthiesse): Remove fullscreen requirement for presentation. See
137 // crbug.com/687369
138 if (eventType == EventTypeNames::vrdisplayactivate &&
139 supplementable()->frame() && supplementable()->frame()->document() &&
140 Fullscreen::fullscreenEnabled(*supplementable()->frame()->document())) {
136 controller()->setListeningForActivate(true); 141 controller()->setListeningForActivate(true);
137 m_listeningForActivate = true; 142 m_listeningForActivate = true;
138 } else if (eventType == EventTypeNames::vrdisplayconnect) { 143 } else if (eventType == EventTypeNames::vrdisplayconnect) {
139 // If the page is listening for connection events make sure we've created a 144 // If the page is listening for connection events make sure we've created a
140 // controller so that we'll be notified of new devices. 145 // controller so that we'll be notified of new devices.
141 controller(); 146 controller();
142 } 147 }
143 } 148 }
144 149
145 void NavigatorVR::didRemoveEventListener(LocalDOMWindow* window, 150 void NavigatorVR::didRemoveEventListener(LocalDOMWindow* window,
146 const AtomicString& eventType) { 151 const AtomicString& eventType) {
147 if (eventType == EventTypeNames::vrdisplayactivate && 152 if (eventType == EventTypeNames::vrdisplayactivate &&
148 !window->hasEventListeners(EventTypeNames::vrdisplayactivate)) { 153 !window->hasEventListeners(EventTypeNames::vrdisplayactivate)) {
149 controller()->setListeningForActivate(false); 154 controller()->setListeningForActivate(false);
150 m_listeningForActivate = false; 155 m_listeningForActivate = false;
151 } 156 }
152 } 157 }
153 158
154 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) { 159 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) {
155 if (m_controller) { 160 if (m_controller) {
156 m_controller->setListeningForActivate(false); 161 m_controller->setListeningForActivate(false);
157 m_listeningForActivate = false; 162 m_listeningForActivate = false;
158 } 163 }
159 } 164 }
160 165
161 } // namespace blink 166 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/vr/VRDisplay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698