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" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 if (interfaceProvider) | 189 if (interfaceProvider) |
190 interfaceProvider->getInterface(mojo::MakeRequest(&m_service)); | 190 interfaceProvider->getInterface(mojo::MakeRequest(&m_service)); |
191 | 191 |
192 if (m_service) { | 192 if (m_service) { |
193 // Create an associated interface ptr and pass it to the | 193 // Create an associated interface ptr and pass it to the |
194 // WebBluetoothService so that it can send us events without us | 194 // WebBluetoothService so that it can send us events without us |
195 // prompting. | 195 // prompting. |
196 mojom::blink::WebBluetoothServiceClientAssociatedPtrInfo ptrInfo; | 196 mojom::blink::WebBluetoothServiceClientAssociatedPtrInfo ptrInfo; |
197 m_clientBinding.Bind(&ptrInfo, m_service.associated_group()); | 197 m_clientBinding.Bind(&ptrInfo); |
198 m_service->SetClient(std::move(ptrInfo)); | 198 m_service->SetClient(std::move(ptrInfo)); |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 if (!m_service) { | 202 if (!m_service) { |
203 return ScriptPromise::rejectWithDOMException( | 203 return ScriptPromise::rejectWithDOMException( |
204 scriptState, DOMException::create(NotSupportedError)); | 204 scriptState, DOMException::create(NotSupportedError)); |
205 } | 205 } |
206 | 206 |
207 // In order to convert the arguments from service names and aliases to just | 207 // In order to convert the arguments from service names and aliases to just |
(...skipping 76 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 |