Chromium Code Reviews| 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/bluetooth/Bluetooth.h" | 5 #include "modules/bluetooth/Bluetooth.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| 11 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/frame/UseCounter.h" | |
| 12 #include "modules/bluetooth/BluetoothDevice.h" | 13 #include "modules/bluetooth/BluetoothDevice.h" |
| 13 #include "modules/bluetooth/BluetoothError.h" | 14 #include "modules/bluetooth/BluetoothError.h" |
| 14 #include "modules/bluetooth/BluetoothSupplement.h" | 15 #include "modules/bluetooth/BluetoothSupplement.h" |
| 15 #include "modules/bluetooth/BluetoothUUID.h" | 16 #include "modules/bluetooth/BluetoothUUID.h" |
| 16 #include "modules/bluetooth/RequestDeviceOptions.h" | 17 #include "modules/bluetooth/RequestDeviceOptions.h" |
| 17 #include "platform/UserGestureIndicator.h" | 18 #include "platform/UserGestureIndicator.h" |
| 18 #include "public/platform/modules/bluetooth/WebBluetooth.h" | 19 #include "public/platform/modules/bluetooth/WebBluetooth.h" |
| 19 #include "public/platform/modules/bluetooth/WebRequestDeviceOptions.h" | 20 #include "public/platform/modules/bluetooth/WebRequestDeviceOptions.h" |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 convertRequestDeviceOptions(options, webOptions, exceptionState); | 170 convertRequestDeviceOptions(options, webOptions, exceptionState); |
| 170 if (exceptionState.hadException()) | 171 if (exceptionState.hadException()) |
| 171 return exceptionState.reject(scriptState); | 172 return exceptionState.reject(scriptState); |
| 172 | 173 |
| 173 // Subsequent steps are handled in the browser process. | 174 // Subsequent steps are handled in the browser process. |
| 174 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 175 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 175 ScriptPromise promise = resolver->promise(); | 176 ScriptPromise promise = resolver->promise(); |
| 176 webbluetooth->requestDevice( | 177 webbluetooth->requestDevice( |
| 177 webOptions, | 178 webOptions, |
| 178 new CallbackPromiseAdapter<BluetoothDevice, BluetoothError>(resolver)); | 179 new CallbackPromiseAdapter<BluetoothDevice, BluetoothError>(resolver)); |
| 180 UseCounter::count(context, UseCounter::WebBluetoothRequestDevice); | |
|
scheib
2016/10/28 23:20:35
Instead of using this here, use IDL MeasureAs exte
juncai
2016/10/28 23:49:45
Done.
| |
| 179 return promise; | 181 return promise; |
| 180 } | 182 } |
| 181 | 183 |
| 182 } // namespace blink | 184 } // namespace blink |
| OLD | NEW |