| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/BluetoothDevice.h" | 5 #include "modules/bluetooth/BluetoothDevice.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" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 DEFINE_TRACE(BluetoothDevice) | 67 DEFINE_TRACE(BluetoothDevice) |
| 68 { | 68 { |
| 69 EventTargetWithInlineData::trace(visitor); | 69 EventTargetWithInlineData::trace(visitor); |
| 70 ActiveDOMObject::trace(visitor); | 70 ActiveDOMObject::trace(visitor); |
| 71 visitor->trace(m_adData); | 71 visitor->trace(m_adData); |
| 72 visitor->trace(m_gatt); | 72 visitor->trace(m_gatt); |
| 73 } | 73 } |
| 74 | 74 |
| 75 unsigned BluetoothDevice::deviceClass(bool& isNull) | |
| 76 { | |
| 77 isNull = false; | |
| 78 return m_webDevice->deviceClass; | |
| 79 } | |
| 80 | |
| 81 String BluetoothDevice::vendorIDSource() | |
| 82 { | |
| 83 switch (m_webDevice->vendorIDSource) { | |
| 84 case WebBluetoothDevice::VendorIDSource::Unknown: return String(); | |
| 85 case WebBluetoothDevice::VendorIDSource::Bluetooth: return "bluetooth"; | |
| 86 case WebBluetoothDevice::VendorIDSource::USB: return "usb"; | |
| 87 } | |
| 88 ASSERT_NOT_REACHED(); | |
| 89 return String(); | |
| 90 } | |
| 91 | |
| 92 unsigned BluetoothDevice::vendorID(bool& isNull) | |
| 93 { | |
| 94 isNull = false; | |
| 95 return m_webDevice->vendorID; | |
| 96 } | |
| 97 | |
| 98 unsigned BluetoothDevice::productID(bool& isNull) | |
| 99 { | |
| 100 isNull = false; | |
| 101 return m_webDevice->productID; | |
| 102 } | |
| 103 | |
| 104 unsigned BluetoothDevice::productVersion(bool& isNull) | |
| 105 { | |
| 106 isNull = false; | |
| 107 return m_webDevice->productVersion; | |
| 108 } | |
| 109 | |
| 110 Vector<String> BluetoothDevice::uuids() | 75 Vector<String> BluetoothDevice::uuids() |
| 111 { | 76 { |
| 112 Vector<String> uuids(m_webDevice->uuids.size()); | 77 Vector<String> uuids(m_webDevice->uuids.size()); |
| 113 for (size_t i = 0; i < m_webDevice->uuids.size(); ++i) | 78 for (size_t i = 0; i < m_webDevice->uuids.size(); ++i) |
| 114 uuids[i] = m_webDevice->uuids[i]; | 79 uuids[i] = m_webDevice->uuids[i]; |
| 115 return uuids; | 80 return uuids; |
| 116 } | 81 } |
| 117 | 82 |
| 118 ScriptPromise BluetoothDevice::connectGATT(ScriptState* scriptState) | 83 ScriptPromise BluetoothDevice::connectGATT(ScriptState* scriptState) |
| 119 { | 84 { |
| 120 return m_gatt->connect(scriptState); | 85 return m_gatt->connect(scriptState); |
| 121 } | 86 } |
| 122 | 87 |
| 123 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |