| 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 <memory> |
| 8 #include <utility> |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 9 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 11 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMException.h" | 12 #include "core/dom/DOMException.h" |
| 11 #include "core/dom/Document.h" | 13 #include "core/dom/Document.h" |
| 12 #include "core/dom/ExceptionCode.h" | 14 #include "core/dom/ExceptionCode.h" |
| 13 #include "core/dom/ExecutionContext.h" | 15 #include "core/dom/ExecutionContext.h" |
| 14 #include "core/frame/LocalFrame.h" | 16 #include "core/frame/LocalFrame.h" |
| 15 #include "modules/bluetooth/BluetoothDevice.h" | 17 #include "modules/bluetooth/BluetoothDevice.h" |
| 16 #include "modules/bluetooth/BluetoothError.h" | 18 #include "modules/bluetooth/BluetoothError.h" |
| 17 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" | 19 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" |
| 18 #include "modules/bluetooth/BluetoothUUID.h" | 20 #include "modules/bluetooth/BluetoothUUID.h" |
| 19 #include "modules/bluetooth/RequestDeviceOptions.h" | 21 #include "modules/bluetooth/RequestDeviceOptions.h" |
| 20 #include "platform/UserGestureIndicator.h" | 22 #include "platform/UserGestureIndicator.h" |
| 21 #include "public/platform/InterfaceProvider.h" | 23 #include "public/platform/InterfaceProvider.h" |
| 22 #include "public/platform/Platform.h" | 24 #include "public/platform/Platform.h" |
| 23 #include <memory> | |
| 24 #include <utility> | |
| 25 | 25 |
| 26 namespace blink { | 26 namespace blink { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 // Per the Bluetooth Spec: The name is a user-friendly name associated with the | 29 // Per the Bluetooth Spec: The name is a user-friendly name associated with the |
| 30 // device and consists of a maximum of 248 bytes coded according to the UTF-8 | 30 // device and consists of a maximum of 248 bytes coded according to the UTF-8 |
| 31 // standard. | 31 // standard. |
| 32 const size_t kMaxDeviceNameLength = 248; | 32 const size_t kMaxDeviceNameLength = 248; |
| 33 const char kDeviceNameTooLong[] = | 33 const char kDeviceNameTooLong[] = |
| 34 "A device name can't be longer than 248 bytes."; | 34 "A device name can't be longer than 248 bytes."; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 BluetoothDevice* device = m_deviceInstanceMap.get(id); | 284 BluetoothDevice* device = m_deviceInstanceMap.get(id); |
| 285 if (!device) { | 285 if (!device) { |
| 286 device = BluetoothDevice::take(resolver, std::move(devicePtr), this); | 286 device = BluetoothDevice::take(resolver, std::move(devicePtr), this); |
| 287 auto result = m_deviceInstanceMap.insert(id, device); | 287 auto result = m_deviceInstanceMap.insert(id, device); |
| 288 DCHECK(result.isNewEntry); | 288 DCHECK(result.isNewEntry); |
| 289 } | 289 } |
| 290 return device; | 290 return device; |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace blink | 293 } // namespace blink |
| OLD | NEW |