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 controller()->getDevices(adoptPtr(new VRGetDevicesCallback(resolver, m_hardw
areUnits.get()))); |
62 | 62 |
63 return promise; | 63 return promise; |
64 } | 64 } |
65 | 65 |
66 VRController* NavigatorVRDevice::controller() | 66 VRController* NavigatorVRDevice::controller() |
67 { | 67 { |
68 if (!frame()) | 68 if (!frame()) |
69 return 0; | 69 return 0; |
70 | 70 |
71 return VRController::from(*frame()); | 71 return VRController::from(*frame()); |
(...skipping 12 matching lines...) Expand all Loading... |
84 { | 84 { |
85 m_hardwareUnits = new VRHardwareUnitCollection(this); | 85 m_hardwareUnits = new VRHardwareUnitCollection(this); |
86 } | 86 } |
87 | 87 |
88 const char* NavigatorVRDevice::supplementName() | 88 const char* NavigatorVRDevice::supplementName() |
89 { | 89 { |
90 return "NavigatorVRDevice"; | 90 return "NavigatorVRDevice"; |
91 } | 91 } |
92 | 92 |
93 } // namespace blink | 93 } // namespace blink |
OLD | NEW |