| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 const std::string& characteristic_instance_id, | 129 const std::string& characteristic_instance_id, |
| 130 const RemoteCharacteristicStopNotificationsCallback& callback) override; | 130 const RemoteCharacteristicStopNotificationsCallback& callback) override; |
| 131 void RemoteCharacteristicGetDescriptors( | 131 void RemoteCharacteristicGetDescriptors( |
| 132 const std::string& service_instance_id, | 132 const std::string& service_instance_id, |
| 133 blink::mojom::WebBluetoothGATTQueryQuantity quantity, | 133 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 134 const base::Optional<device::BluetoothUUID>& characteristics_uuid, | 134 const base::Optional<device::BluetoothUUID>& characteristics_uuid, |
| 135 const RemoteCharacteristicGetDescriptorsCallback& callback) override; | 135 const RemoteCharacteristicGetDescriptorsCallback& callback) override; |
| 136 void RemoteDescriptorReadValue( | 136 void RemoteDescriptorReadValue( |
| 137 const std::string& characteristic_instance_id, | 137 const std::string& characteristic_instance_id, |
| 138 const RemoteDescriptorReadValueCallback& callback) override; | 138 const RemoteDescriptorReadValueCallback& callback) override; |
| 139 void RemoteDescriptorWriteValue( |
| 140 const std::string& descriptor_instance_id, |
| 141 const std::vector<uint8_t>& value, |
| 142 const RemoteDescriptorWriteValueCallback& callback) override; |
| 139 | 143 |
| 140 void RequestDeviceImpl( | 144 void RequestDeviceImpl( |
| 141 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, | 145 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, |
| 142 const RequestDeviceCallback& callback, | 146 const RequestDeviceCallback& callback, |
| 143 device::BluetoothAdapter* adapter); | 147 device::BluetoothAdapter* adapter); |
| 144 | 148 |
| 145 // Should only be run after the services have been discovered for | 149 // Should only be run after the services have been discovered for |
| 146 // |device_address|. | 150 // |device_address|. |
| 147 void RemoteServerGetPrimaryServicesImpl( | 151 void RemoteServerGetPrimaryServicesImpl( |
| 148 const WebBluetoothDeviceId& device_id, | 152 const WebBluetoothDeviceId& device_id, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 const RemoteCharacteristicStopNotificationsCallback& callback); | 203 const RemoteCharacteristicStopNotificationsCallback& callback); |
| 200 | 204 |
| 201 // Callbacks for BluetoothRemoteGattDescriptor::ReadRemoteDescriptor. | 205 // Callbacks for BluetoothRemoteGattDescriptor::ReadRemoteDescriptor. |
| 202 void OnDescriptorReadValueSuccess( | 206 void OnDescriptorReadValueSuccess( |
| 203 const RemoteDescriptorReadValueCallback& callback, | 207 const RemoteDescriptorReadValueCallback& callback, |
| 204 const std::vector<uint8_t>& value); | 208 const std::vector<uint8_t>& value); |
| 205 void OnDescriptorReadValueFailed( | 209 void OnDescriptorReadValueFailed( |
| 206 const RemoteDescriptorReadValueCallback& callback, | 210 const RemoteDescriptorReadValueCallback& callback, |
| 207 device::BluetoothRemoteGattService::GattErrorCode error_code); | 211 device::BluetoothRemoteGattService::GattErrorCode error_code); |
| 208 | 212 |
| 213 // Callbacks for BluetoothRemoteGattDescriptor::WriteRemoteDescriptor. |
| 214 void OnDescriptorWriteValueSuccess( |
| 215 const RemoteDescriptorWriteValueCallback& callback); |
| 216 void OnDescriptorWriteValueFailed( |
| 217 const RemoteDescriptorWriteValueCallback& callback, |
| 218 device::BluetoothRemoteGattService::GattErrorCode error_code); |
| 219 |
| 209 // Functions to query the platform cache for the bluetooth object. | 220 // Functions to query the platform cache for the bluetooth object. |
| 210 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the | 221 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the |
| 211 // cache. Otherwise result.outcome that can used to record the outcome and | 222 // cache. Otherwise result.outcome that can used to record the outcome and |
| 212 // result.error will contain the error that should be sent to the renderer. | 223 // result.error will contain the error that should be sent to the renderer. |
| 213 // One of the possible outcomes is BAD_RENDERER. In this case we crash the | 224 // One of the possible outcomes is BAD_RENDERER. In this case we crash the |
| 214 // renderer, record the reason and close the pipe, so it's safe to drop | 225 // renderer, record the reason and close the pipe, so it's safe to drop |
| 215 // any callbacks. | 226 // any callbacks. |
| 216 | 227 |
| 217 // Queries the platform cache for a Device with |device_id| for |origin|. | 228 // Queries the platform cache for a Device with |device_id| for |origin|. |
| 218 // Fills in the |outcome| field and the |device| field if successful. | 229 // Fills in the |outcome| field and the |device| field if successful. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 mojo::Binding<blink::mojom::WebBluetoothService> binding_; | 289 mojo::Binding<blink::mojom::WebBluetoothService> binding_; |
| 279 | 290 |
| 280 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; | 291 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; |
| 281 | 292 |
| 282 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); | 293 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); |
| 283 }; | 294 }; |
| 284 | 295 |
| 285 } // namespace content | 296 } // namespace content |
| 286 | 297 |
| 287 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ | 298 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ |
| OLD | NEW |