| 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" |
| 11 #include "modules/vr/NavigatorVR.h" | 11 #include "modules/vr/NavigatorVR.h" |
| 12 #include "modules/vr/VRGetDevicesCallback.h" | 12 #include "modules/vr/VRGetDevicesCallback.h" |
| 13 #include "public/platform/InterfaceProvider.h" | 13 #include "public/platform/Platform.h" |
| 14 #include "services/device/public/interfaces/constants.mojom-blink.h" |
| 15 #include "services/service_manager/public/cpp/connector.h" |
| 14 | 16 |
| 15 #include "platform/wtf/Assertions.h" | 17 #include "platform/wtf/Assertions.h" |
| 16 | 18 |
| 17 namespace blink { | 19 namespace blink { |
| 18 | 20 |
| 19 VRController::VRController(NavigatorVR* navigator_vr) | 21 VRController::VRController(NavigatorVR* navigator_vr) |
| 20 : ContextLifecycleObserver(navigator_vr->GetDocument()), | 22 : ContextLifecycleObserver(navigator_vr->GetDocument()), |
| 21 navigator_vr_(navigator_vr), | 23 navigator_vr_(navigator_vr), |
| 22 display_synced_(false), | 24 display_synced_(false), |
| 23 binding_(this) { | 25 binding_(this) { |
| 24 navigator_vr->GetDocument()->GetFrame()->GetInterfaceProvider()->GetInterface( | 26 Platform::Current()->GetConnector()->BindInterface( |
| 25 mojo::MakeRequest(&service_)); | 27 device::mojom::blink::kServiceName, mojo::MakeRequest(&service_)); |
| 26 service_.set_connection_error_handler(ConvertToBaseCallback( | 28 service_.set_connection_error_handler(ConvertToBaseCallback( |
| 27 WTF::Bind(&VRController::Dispose, WrapWeakPersistent(this)))); | 29 WTF::Bind(&VRController::Dispose, WrapWeakPersistent(this)))); |
| 28 service_->SetClient( | 30 service_->SetClient( |
| 29 binding_.CreateInterfacePtrAndBind(), | 31 binding_.CreateInterfacePtrAndBind(), |
| 30 ConvertToBaseCallback( | 32 ConvertToBaseCallback( |
| 31 WTF::Bind(&VRController::OnDisplaysSynced, WrapPersistent(this)))); | 33 WTF::Bind(&VRController::OnDisplaysSynced, WrapPersistent(this)))); |
| 32 } | 34 } |
| 33 | 35 |
| 34 VRController::~VRController() {} | 36 VRController::~VRController() {} |
| 35 | 37 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 119 } |
| 118 | 120 |
| 119 DEFINE_TRACE(VRController) { | 121 DEFINE_TRACE(VRController) { |
| 120 visitor->Trace(navigator_vr_); | 122 visitor->Trace(navigator_vr_); |
| 121 visitor->Trace(displays_); | 123 visitor->Trace(displays_); |
| 122 | 124 |
| 123 ContextLifecycleObserver::Trace(visitor); | 125 ContextLifecycleObserver::Trace(visitor); |
| 124 } | 126 } |
| 125 | 127 |
| 126 } // namespace blink | 128 } // namespace blink |
| OLD | NEW |