| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/webusb/USB.h" | 6 #include "modules/webusb/USB.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 : m_controller(USBController::from(frame)) | 75 : m_controller(USBController::from(frame)) |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 ScriptPromise USB::getDevices(ScriptState* scriptState, const USBDeviceEnumerati
onOptions& options) | 79 ScriptPromise USB::getDevices(ScriptState* scriptState, const USBDeviceEnumerati
onOptions& options) |
| 80 { | 80 { |
| 81 WebUSBClient* client = m_controller->client(); | 81 WebUSBClient* client = m_controller->client(); |
| 82 if (!client) | 82 if (!client) |
| 83 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::
create(NotSupportedError)); | 83 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::
create(NotSupportedError)); |
| 84 | 84 |
| 85 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); | 85 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 86 ScriptPromise promise = resolver->promise(); | 86 ScriptPromise promise = resolver->promise(); |
| 87 | 87 |
| 88 WebUSBDeviceEnumerationOptions webOptions; | 88 WebUSBDeviceEnumerationOptions webOptions; |
| 89 convertDeviceEnumerationOptions(options, &webOptions); | 89 convertDeviceEnumerationOptions(options, &webOptions); |
| 90 | 90 |
| 91 // TODO(rockot): Re-enable this after CPA changes land. | 91 // TODO(rockot): Re-enable this after CPA changes land. |
| 92 // That's https://codereview.chromium.org/1240763002/ and dependent patches. | 92 // That's https://codereview.chromium.org/1240763002/ and dependent patches. |
| 93 // client->getDevices(webOptions, new CallbackPromiseAdapter<DeviceArray, US
BError>(resolver)); | 93 // client->getDevices(webOptions, new CallbackPromiseAdapter<DeviceArray, US
BError>(resolver)); |
| 94 ASSERT_NOT_REACHED(); | 94 ASSERT_NOT_REACHED(); |
| 95 | 95 |
| 96 return promise; | 96 return promise; |
| 97 } | 97 } |
| 98 | 98 |
| 99 DEFINE_TRACE(USB) | 99 DEFINE_TRACE(USB) |
| 100 { | 100 { |
| 101 visitor->trace(m_controller); | 101 visitor->trace(m_controller); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |