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 "content/renderer/bluetooth/web_bluetooth_impl.h" | 5 #include "content/renderer/bluetooth/web_bluetooth_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 GetWebBluetoothService().RemoteServerDisconnect( | 60 GetWebBluetoothService().RemoteServerDisconnect( |
61 mojo::String::From(device_id)); | 61 mojo::String::From(device_id)); |
62 } | 62 } |
63 | 63 |
64 void WebBluetoothImpl::getPrimaryService( | 64 void WebBluetoothImpl::getPrimaryService( |
65 const blink::WebString& device_id, | 65 const blink::WebString& device_id, |
66 const blink::WebString& service_uuid, | 66 const blink::WebString& service_uuid, |
67 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) { | 67 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) { |
68 GetWebBluetoothService().RemoteServerGetPrimaryService( | 68 GetWebBluetoothService().RemoteServerGetPrimaryService( |
69 mojo::String::From(device_id), mojo::String::From(service_uuid), | 69 mojo::String::From(device_id), |
| 70 base::WrapUnique(new device::BluetoothUUID(service_uuid.utf8())), |
70 base::Bind(&WebBluetoothImpl::OnGetPrimaryServiceComplete, | 71 base::Bind(&WebBluetoothImpl::OnGetPrimaryServiceComplete, |
71 base::Unretained(this), device_id, | 72 base::Unretained(this), device_id, |
72 base::Passed(base::WrapUnique(callbacks)))); | 73 base::Passed(base::WrapUnique(callbacks)))); |
73 } | 74 } |
74 | 75 |
75 void WebBluetoothImpl::getCharacteristics( | 76 void WebBluetoothImpl::getCharacteristics( |
76 const blink::WebString& service_instance_id, | 77 const blink::WebString& service_instance_id, |
77 blink::mojom::WebBluetoothGATTQueryQuantity quantity, | 78 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
78 const blink::WebString& characteristics_uuid, | 79 const blink::WebString& characteristics_uuid, |
79 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) { | 80 blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) { |
80 GetWebBluetoothService().RemoteServiceGetCharacteristics( | 81 GetWebBluetoothService().RemoteServiceGetCharacteristics( |
81 mojo::String::From(service_instance_id), quantity, | 82 mojo::String::From(service_instance_id), quantity, |
82 characteristics_uuid.isEmpty() ? nullptr | 83 characteristics_uuid.isEmpty() |
83 : mojo::String::From(characteristics_uuid), | 84 ? nullptr |
| 85 : base::WrapUnique( |
| 86 new device::BluetoothUUID(characteristics_uuid.utf8())), |
84 base::Bind(&WebBluetoothImpl::OnGetCharacteristicsComplete, | 87 base::Bind(&WebBluetoothImpl::OnGetCharacteristicsComplete, |
85 base::Unretained(this), service_instance_id, | 88 base::Unretained(this), service_instance_id, |
86 base::Passed(base::WrapUnique(callbacks)))); | 89 base::Passed(base::WrapUnique(callbacks)))); |
87 } | 90 } |
88 | 91 |
89 void WebBluetoothImpl::readValue( | 92 void WebBluetoothImpl::readValue( |
90 const blink::WebString& characteristic_instance_id, | 93 const blink::WebString& characteristic_instance_id, |
91 blink::WebBluetoothReadValueCallbacks* callbacks) { | 94 blink::WebBluetoothReadValueCallbacks* callbacks) { |
92 GetWebBluetoothService().RemoteCharacteristicReadValue( | 95 GetWebBluetoothService().RemoteCharacteristicReadValue( |
93 mojo::String::From(characteristic_instance_id), | 96 mojo::String::From(characteristic_instance_id), |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // Create an associated interface ptr and pass it to the WebBluetoothService | 288 // Create an associated interface ptr and pass it to the WebBluetoothService |
286 // so that it can send us events without us prompting. | 289 // so that it can send us events without us prompting. |
287 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo ptr_info; | 290 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo ptr_info; |
288 binding_.Bind(&ptr_info, web_bluetooth_service_.associated_group()); | 291 binding_.Bind(&ptr_info, web_bluetooth_service_.associated_group()); |
289 web_bluetooth_service_->SetClient(std::move(ptr_info)); | 292 web_bluetooth_service_->SetClient(std::move(ptr_info)); |
290 } | 293 } |
291 return *web_bluetooth_service_; | 294 return *web_bluetooth_service_; |
292 } | 295 } |
293 | 296 |
294 } // namespace content | 297 } // namespace content |
OLD | NEW |