| OLD | NEW |
| 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" | |
| 11 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/dom/Fullscreen.h" | 11 #include "core/dom/Fullscreen.h" |
| 13 #include "core/frame/LocalDOMWindow.h" | 12 #include "core/frame/LocalDOMWindow.h" |
| 14 #include "core/frame/LocalFrame.h" | 13 #include "core/frame/LocalFrame.h" |
| 15 #include "core/frame/Navigator.h" | 14 #include "core/frame/Navigator.h" |
| 16 #include "core/frame/UseCounter.h" | 15 #include "core/frame/UseCounter.h" |
| 17 #include "core/page/Page.h" | 16 #include "core/page/Page.h" |
| 18 #include "modules/vr/VRController.h" | 17 #include "modules/vr/VRController.h" |
| 19 #include "modules/vr/VRDisplay.h" | 18 #include "modules/vr/VRDisplay.h" |
| 20 #include "modules/vr/VRGetDevicesCallback.h" | 19 #include "modules/vr/VRGetDevicesCallback.h" |
| 21 #include "modules/vr/VRPose.h" | 20 #include "modules/vr/VRPose.h" |
| 22 #include "platform/UserGestureIndicator.h" | |
| 23 #include "public/platform/Platform.h" | 21 #include "public/platform/Platform.h" |
| 24 #include "wtf/PtrUtil.h" | 22 #include "wtf/PtrUtil.h" |
| 25 | 23 |
| 26 namespace blink { | 24 namespace blink { |
| 27 | 25 |
| 28 namespace { | 26 namespace { |
| 29 | 27 |
| 30 void rejectNavigatorDetached(ScriptPromiseResolver* resolver) { | 28 void rejectNavigatorDetached(ScriptPromiseResolver* resolver) { |
| 31 DOMException* exception = DOMException::create( | 29 DOMException* exception = DOMException::create( |
| 32 InvalidStateError, "The object is no longer associated with a document."); | 30 InvalidStateError, "The object is no longer associated with a document."); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return "NavigatorVR"; | 122 return "NavigatorVR"; |
| 125 } | 123 } |
| 126 | 124 |
| 127 void NavigatorVR::enqueueVREvent(VRDisplayEvent* event) { | 125 void NavigatorVR::enqueueVREvent(VRDisplayEvent* event) { |
| 128 if (!supplementable()->frame()) | 126 if (!supplementable()->frame()) |
| 129 return; | 127 return; |
| 130 | 128 |
| 131 supplementable()->frame()->domWindow()->enqueueWindowEvent(event); | 129 supplementable()->frame()->domWindow()->enqueueWindowEvent(event); |
| 132 } | 130 } |
| 133 | 131 |
| 134 void NavigatorVR::dispatchVRGestureEvent(VRDisplayEvent* event) { | 132 void NavigatorVR::dispatchVREvent(VRDisplayEvent* event) { |
| 135 if (!(supplementable()->frame())) | 133 if (!(supplementable()->frame())) |
| 136 return; | 134 return; |
| 137 | 135 |
| 138 UserGestureIndicator gestureIndicator( | |
| 139 DocumentUserGestureToken::create(document())); | |
| 140 LocalDOMWindow* window = supplementable()->frame()->domWindow(); | 136 LocalDOMWindow* window = supplementable()->frame()->domWindow(); |
| 141 DCHECK(window); | 137 DCHECK(window); |
| 142 event->setTarget(window); | 138 event->setTarget(window); |
| 143 window->dispatchEvent(event); | 139 window->dispatchEvent(event); |
| 144 } | 140 } |
| 145 | 141 |
| 146 void NavigatorVR::focusedFrameChanged() { | 142 void NavigatorVR::focusedFrameChanged() { |
| 147 bool focused = isFrameFocused(supplementable()->frame()); | 143 bool focused = isFrameFocused(supplementable()->frame()); |
| 148 if (focused == m_focused) | 144 if (focused == m_focused) |
| 149 return; | 145 return; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 177 |
| 182 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) { | 178 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) { |
| 183 if (!m_controller) | 179 if (!m_controller) |
| 184 return; | 180 return; |
| 185 | 181 |
| 186 m_controller->setListeningForActivate(false); | 182 m_controller->setListeningForActivate(false); |
| 187 m_listeningForActivate = false; | 183 m_listeningForActivate = false; |
| 188 } | 184 } |
| 189 | 185 |
| 190 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |