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 "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/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 resolver->resolve(m_displays); | 45 resolver->resolve(m_displays); |
46 return; | 46 return; |
47 } | 47 } |
48 | 48 |
49 // Otherwise we're still waiting for the full list of displays to be populated | 49 // Otherwise we're still waiting for the full list of displays to be populated |
50 // so queue up the promise for resolution when onDisplaysSynced is called. | 50 // so queue up the promise for resolution when onDisplaysSynced is called. |
51 m_pendingGetDevicesCallbacks.append( | 51 m_pendingGetDevicesCallbacks.append( |
52 makeUnique<VRGetDevicesCallback>(resolver)); | 52 makeUnique<VRGetDevicesCallback>(resolver)); |
53 } | 53 } |
54 | 54 |
| 55 void VRController::setListeningForActivate(bool listening) { |
| 56 if (m_service) |
| 57 m_service->SetListeningForActivate(listening); |
| 58 } |
| 59 |
55 // Each time a new VRDisplay is connected we'll recieve a VRDisplayPtr for it | 60 // Each time a new VRDisplay is connected we'll recieve a VRDisplayPtr for it |
56 // here. Upon calling SetClient in the constructor we should receive one call | 61 // here. Upon calling SetClient in the constructor we should receive one call |
57 // for each VRDisplay that was already connected at the time. | 62 // for each VRDisplay that was already connected at the time. |
58 void VRController::OnDisplayConnected( | 63 void VRController::OnDisplayConnected( |
59 device::mojom::blink::VRDisplayPtr display, | 64 device::mojom::blink::VRDisplayPtr display, |
60 device::mojom::blink::VRDisplayClientRequest request, | 65 device::mojom::blink::VRDisplayClientRequest request, |
61 device::mojom::blink::VRDisplayInfoPtr displayInfo) { | 66 device::mojom::blink::VRDisplayInfoPtr displayInfo) { |
62 VRDisplay* vrDisplay = | 67 VRDisplay* vrDisplay = |
63 new VRDisplay(m_navigatorVR, std::move(display), std::move(request)); | 68 new VRDisplay(m_navigatorVR, std::move(display), std::move(request)); |
64 vrDisplay->update(displayInfo); | 69 vrDisplay->update(displayInfo); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 112 } |
108 | 113 |
109 DEFINE_TRACE(VRController) { | 114 DEFINE_TRACE(VRController) { |
110 visitor->trace(m_navigatorVR); | 115 visitor->trace(m_navigatorVR); |
111 visitor->trace(m_displays); | 116 visitor->trace(m_displays); |
112 | 117 |
113 ContextLifecycleObserver::trace(visitor); | 118 ContextLifecycleObserver::trace(visitor); |
114 } | 119 } |
115 | 120 |
116 } // namespace blink | 121 } // namespace blink |
OLD | NEW |