| 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" | 10 #include "core/dom/DocumentUserGestureToken.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 DEFINE_TRACE(NavigatorVR) { | 90 DEFINE_TRACE(NavigatorVR) { |
| 91 visitor->trace(m_controller); | 91 visitor->trace(m_controller); |
| 92 | 92 |
| 93 Supplement<Navigator>::trace(visitor); | 93 Supplement<Navigator>::trace(visitor); |
| 94 DOMWindowProperty::trace(visitor); | 94 DOMWindowProperty::trace(visitor); |
| 95 PageVisibilityObserver::trace(visitor); | 95 PageVisibilityObserver::trace(visitor); |
| 96 } | 96 } |
| 97 | 97 |
| 98 NavigatorVR::NavigatorVR(LocalFrame* frame) | 98 NavigatorVR::NavigatorVR(LocalFrame* frame) |
| 99 : DOMWindowProperty(frame), PageVisibilityObserver(frame->page()) { | 99 : DOMWindowProperty(frame), PageVisibilityObserver(frame->page()) { |
| 100 frame->localDOMWindow()->registerEventListenerObserver(this); | 100 frame->domWindow()->registerEventListenerObserver(this); |
| 101 } | 101 } |
| 102 | 102 |
| 103 NavigatorVR::~NavigatorVR() {} | 103 NavigatorVR::~NavigatorVR() {} |
| 104 | 104 |
| 105 const char* NavigatorVR::supplementName() { | 105 const char* NavigatorVR::supplementName() { |
| 106 return "NavigatorVR"; | 106 return "NavigatorVR"; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void NavigatorVR::enqueueVREvent(VRDisplayEvent* event) { | 109 void NavigatorVR::enqueueVREvent(VRDisplayEvent* event) { |
| 110 if (frame() && frame()->localDOMWindow()) { | 110 // TODO(dcheng): Why does this need to check both frame and domWindow? |
| 111 frame()->localDOMWindow()->enqueueWindowEvent(event); | 111 if (frame() && frame()->domWindow()) { |
| 112 frame()->domWindow()->enqueueWindowEvent(event); |
| 112 } | 113 } |
| 113 } | 114 } |
| 114 | 115 |
| 115 void NavigatorVR::dispatchVRGestureEvent(VRDisplayEvent* event) { | 116 void NavigatorVR::dispatchVRGestureEvent(VRDisplayEvent* event) { |
| 116 if (frame() && frame()->localDOMWindow()) { | 117 // TODO(dcheng): Why does this need to check both frame and domWindow? |
| 118 if (frame() && frame()->domWindow()) { |
| 117 UserGestureIndicator gestureIndicator( | 119 UserGestureIndicator gestureIndicator( |
| 118 DocumentUserGestureToken::create(frame()->document())); | 120 DocumentUserGestureToken::create(frame()->document())); |
| 119 event->setTarget(frame()->localDOMWindow()); | 121 event->setTarget(frame()->domWindow()); |
| 120 frame()->localDOMWindow()->dispatchEvent(event); | 122 frame()->domWindow()->dispatchEvent(event); |
| 121 } | 123 } |
| 122 } | 124 } |
| 123 | 125 |
| 124 void NavigatorVR::pageVisibilityChanged() { | 126 void NavigatorVR::pageVisibilityChanged() { |
| 125 if (!page()) | 127 if (!page()) |
| 126 return; | 128 return; |
| 127 if (m_controller) { | 129 if (m_controller) { |
| 128 m_controller->setListeningForActivate(page()->isPageVisible() && | 130 m_controller->setListeningForActivate(page()->isPageVisible() && |
| 129 m_listeningForActivate); | 131 m_listeningForActivate); |
| 130 } | 132 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 152 } | 154 } |
| 153 | 155 |
| 154 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) { | 156 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) { |
| 155 if (m_controller) { | 157 if (m_controller) { |
| 156 m_controller->setListeningForActivate(false); | 158 m_controller->setListeningForActivate(false); |
| 157 m_listeningForActivate = false; | 159 m_listeningForActivate = false; |
| 158 } | 160 } |
| 159 } | 161 } |
| 160 | 162 |
| 161 } // namespace blink | 163 } // namespace blink |
| OLD | NEW |