| 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/NavigatorVRDevice.h" | 5 #include "modules/vr/NavigatorVRDevice.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/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ScriptPromise promise = resolver->promise(); | 51 ScriptPromise promise = resolver->promise(); |
| 52 | 52 |
| 53 Document* document = m_frame ? m_frame->document() : 0; | 53 Document* document = m_frame ? m_frame->document() : 0; |
| 54 | 54 |
| 55 if (!document || !controller()) { | 55 if (!document || !controller()) { |
| 56 DOMException* exception = DOMException::create(InvalidStateError, "The o
bject is no longer associated to a document."); | 56 DOMException* exception = DOMException::create(InvalidStateError, "The o
bject is no longer associated to a document."); |
| 57 resolver->reject(exception); | 57 resolver->reject(exception); |
| 58 return promise; | 58 return promise; |
| 59 } | 59 } |
| 60 | 60 |
| 61 controller()->getDevices(new VRGetDevicesCallback(resolver, m_hardwareUnits.
get())); | 61 std::unique_ptr<VRGetDevicesCallback> callback(new VRGetDevicesCallback(reso
lver, m_hardwareUnits.get())); |
| 62 controller()->getDevices(std::move(callback)); |
| 62 | 63 |
| 63 return promise; | 64 return promise; |
| 64 } | 65 } |
| 65 | 66 |
| 66 VRController* NavigatorVRDevice::controller() | 67 VRController* NavigatorVRDevice::controller() |
| 67 { | 68 { |
| 68 if (!frame()) | 69 if (!frame()) |
| 69 return 0; | 70 return 0; |
| 70 | 71 |
| 71 return VRController::from(*frame()); | 72 return VRController::from(*frame()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 84 { | 85 { |
| 85 m_hardwareUnits = new VRHardwareUnitCollection(this); | 86 m_hardwareUnits = new VRHardwareUnitCollection(this); |
| 86 } | 87 } |
| 87 | 88 |
| 88 const char* NavigatorVRDevice::supplementName() | 89 const char* NavigatorVRDevice::supplementName() |
| 89 { | 90 { |
| 90 return "NavigatorVRDevice"; | 91 return "NavigatorVRDevice"; |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |