| 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/VRController.h" | 5 #include "modules/vr/VRController.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "modules/vr/NavigatorVR.h" | 10 #include "modules/vr/NavigatorVR.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 if (!vrDisplay) | 198 if (!vrDisplay) |
| 199 return; | 199 return; |
| 200 | 200 |
| 201 vrDisplay->disconnected(); | 201 vrDisplay->disconnected(); |
| 202 | 202 |
| 203 m_navigatorVR->fireVREvent( | 203 m_navigatorVR->fireVREvent( |
| 204 VRDisplayEvent::create(EventTypeNames::vrdisplaydisconnect, true, false, | 204 VRDisplayEvent::create(EventTypeNames::vrdisplaydisconnect, true, false, |
| 205 vrDisplay, "disconnect")); | 205 vrDisplay, "disconnect")); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void VRController::OnDisplayBlur(unsigned index) { |
| 209 VRDisplay* vrDisplay = getDisplayForIndex(index); |
| 210 if (!vrDisplay) |
| 211 return; |
| 212 |
| 213 vrDisplay->onDisplayBlur(); |
| 214 } |
| 215 |
| 216 void VRController::OnDisplayFocus(unsigned index) { |
| 217 VRDisplay* vrDisplay = getDisplayForIndex(index); |
| 218 if (!vrDisplay) |
| 219 return; |
| 220 |
| 221 vrDisplay->onDisplayFocus(); |
| 222 } |
| 223 |
| 208 void VRController::contextDestroyed() { | 224 void VRController::contextDestroyed() { |
| 209 // If the document context was destroyed, shut down the client connection | 225 // If the document context was destroyed, shut down the client connection |
| 210 // and never call the mojo service again. | 226 // and never call the mojo service again. |
| 211 m_binding.Close(); | 227 m_binding.Close(); |
| 212 m_service.reset(); | 228 m_service.reset(); |
| 213 | 229 |
| 214 // The context is not automatically cleared, so do it manually. | 230 // The context is not automatically cleared, so do it manually. |
| 215 ContextLifecycleObserver::clearContext(); | 231 ContextLifecycleObserver::clearContext(); |
| 216 } | 232 } |
| 217 | 233 |
| 218 DEFINE_TRACE(VRController) { | 234 DEFINE_TRACE(VRController) { |
| 219 visitor->trace(m_navigatorVR); | 235 visitor->trace(m_navigatorVR); |
| 220 visitor->trace(m_displays); | 236 visitor->trace(m_displays); |
| 221 | 237 |
| 222 ContextLifecycleObserver::trace(visitor); | 238 ContextLifecycleObserver::trace(visitor); |
| 223 } | 239 } |
| 224 | 240 |
| 225 } // namespace blink | 241 } // namespace blink |
| OLD | NEW |