| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 void NotifyCharacteristicValueChanged( | 90 void NotifyCharacteristicValueChanged( |
| 91 const std::string& characteristic_instance_id, | 91 const std::string& characteristic_instance_id, |
| 92 std::vector<uint8_t> value); | 92 std::vector<uint8_t> value); |
| 93 | 93 |
| 94 // WebBluetoothService methods: | 94 // WebBluetoothService methods: |
| 95 void SetClient( | 95 void SetClient( |
| 96 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override; | 96 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override; |
| 97 void RequestDevice(blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, | 97 void RequestDevice(blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, |
| 98 const RequestDeviceCallback& callback) override; | 98 const RequestDeviceCallback& callback) override; |
| 99 void RemoteServerConnect( | 99 void RemoteServerConnect( |
| 100 const mojo::String& device_id, | 100 const BluetoothDeviceId& device_id, |
| 101 const RemoteServerConnectCallback& callback) override; | 101 const RemoteServerConnectCallback& callback) override; |
| 102 void RemoteServerDisconnect(const mojo::String& device_id) override; | 102 void RemoteServerDisconnect(const BluetoothDeviceId& device_id) override; |
| 103 void RemoteServerGetPrimaryService( | 103 void RemoteServerGetPrimaryService( |
| 104 const mojo::String& device_id, | 104 const BluetoothDeviceId& device_id, |
| 105 const base::Optional<device::BluetoothUUID>& service_uuid, | 105 const base::Optional<device::BluetoothUUID>& service_uuid, |
| 106 const RemoteServerGetPrimaryServiceCallback& callback) override; | 106 const RemoteServerGetPrimaryServiceCallback& callback) override; |
| 107 void RemoteServiceGetCharacteristics( | 107 void RemoteServiceGetCharacteristics( |
| 108 const mojo::String& service_instance_id, | 108 const mojo::String& service_instance_id, |
| 109 blink::mojom::WebBluetoothGATTQueryQuantity quantity, | 109 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 110 const base::Optional<device::BluetoothUUID>& characteristics_uuid, | 110 const base::Optional<device::BluetoothUUID>& characteristics_uuid, |
| 111 const RemoteServiceGetCharacteristicsCallback& callback) override; | 111 const RemoteServiceGetCharacteristicsCallback& callback) override; |
| 112 void RemoteCharacteristicReadValue( | 112 void RemoteCharacteristicReadValue( |
| 113 const mojo::String& characteristic_instance_id, | 113 const mojo::String& characteristic_instance_id, |
| 114 const RemoteCharacteristicReadValueCallback& callback) override; | 114 const RemoteCharacteristicReadValueCallback& callback) override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 138 // Callbacks for BluetoothDeviceChooserController::GetDevice. | 138 // Callbacks for BluetoothDeviceChooserController::GetDevice. |
| 139 void OnGetDeviceSuccess( | 139 void OnGetDeviceSuccess( |
| 140 const RequestDeviceCallback& callback, | 140 const RequestDeviceCallback& callback, |
| 141 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, | 141 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, |
| 142 const std::string& device_id); | 142 const std::string& device_id); |
| 143 void OnGetDeviceFailed(const RequestDeviceCallback& callback, | 143 void OnGetDeviceFailed(const RequestDeviceCallback& callback, |
| 144 blink::mojom::WebBluetoothError error); | 144 blink::mojom::WebBluetoothError error); |
| 145 | 145 |
| 146 // Callbacks for BluetoothDevice::CreateGattConnection. | 146 // Callbacks for BluetoothDevice::CreateGattConnection. |
| 147 void OnCreateGATTConnectionSuccess( | 147 void OnCreateGATTConnectionSuccess( |
| 148 const std::string& device_id, | 148 const BluetoothDeviceId& device_id, |
| 149 base::TimeTicks start_time, | 149 base::TimeTicks start_time, |
| 150 const RemoteServerConnectCallback& callback, | 150 const RemoteServerConnectCallback& callback, |
| 151 std::unique_ptr<device::BluetoothGattConnection> connection); | 151 std::unique_ptr<device::BluetoothGattConnection> connection); |
| 152 void OnCreateGATTConnectionFailed( | 152 void OnCreateGATTConnectionFailed( |
| 153 const std::string& device_id, | |
| 154 base::TimeTicks start_time, | 153 base::TimeTicks start_time, |
| 155 const RemoteServerConnectCallback& callback, | 154 const RemoteServerConnectCallback& callback, |
| 156 device::BluetoothDevice::ConnectErrorCode error_code); | 155 device::BluetoothDevice::ConnectErrorCode error_code); |
| 157 | 156 |
| 158 // Callbacks for BluetoothRemoteGattCharacteristic::ReadRemoteCharacteristic. | 157 // Callbacks for BluetoothRemoteGattCharacteristic::ReadRemoteCharacteristic. |
| 159 void OnReadValueSuccess(const RemoteCharacteristicReadValueCallback& callback, | 158 void OnReadValueSuccess(const RemoteCharacteristicReadValueCallback& callback, |
| 160 const std::vector<uint8_t>& value); | 159 const std::vector<uint8_t>& value); |
| 161 void OnReadValueFailed( | 160 void OnReadValueFailed( |
| 162 const RemoteCharacteristicReadValueCallback& callback, | 161 const RemoteCharacteristicReadValueCallback& callback, |
| 163 device::BluetoothRemoteGattService::GattErrorCode error_code); | 162 device::BluetoothRemoteGattService::GattErrorCode error_code); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 185 // Functions to query the platform cache for the bluetooth object. | 184 // Functions to query the platform cache for the bluetooth object. |
| 186 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the | 185 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the |
| 187 // cache. Otherwise result.outcome that can used to record the outcome and | 186 // cache. Otherwise result.outcome that can used to record the outcome and |
| 188 // result.error will contain the error that should be sent to the renderer. | 187 // result.error will contain the error that should be sent to the renderer. |
| 189 // One of the possible outcomes is BAD_RENDERER. In this case we crash the | 188 // One of the possible outcomes is BAD_RENDERER. In this case we crash the |
| 190 // renderer, record the reason and close the pipe, so it's safe to drop | 189 // renderer, record the reason and close the pipe, so it's safe to drop |
| 191 // any callbacks. | 190 // any callbacks. |
| 192 | 191 |
| 193 // Queries the platform cache for a Device with |device_id| for |origin|. | 192 // Queries the platform cache for a Device with |device_id| for |origin|. |
| 194 // Fills in the |outcome| field and the |device| field if successful. | 193 // Fills in the |outcome| field and the |device| field if successful. |
| 195 CacheQueryResult QueryCacheForDevice(const std::string& device_id); | 194 CacheQueryResult QueryCacheForDevice(const BluetoothDeviceId& device_id); |
| 196 | 195 |
| 197 // Queries the platform cache for a Service with |service_instance_id|. Fills | 196 // Queries the platform cache for a Service with |service_instance_id|. Fills |
| 198 // in the |outcome| field, and |device| and |service| fields if successful. | 197 // in the |outcome| field, and |device| and |service| fields if successful. |
| 199 CacheQueryResult QueryCacheForService(const std::string& service_instance_id); | 198 CacheQueryResult QueryCacheForService(const std::string& service_instance_id); |
| 200 | 199 |
| 201 // Queries the platform cache for a characteristic with | 200 // Queries the platform cache for a characteristic with |
| 202 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|, | 201 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|, |
| 203 // |service| and |characteristic| fields if successful. | 202 // |service| and |characteristic| fields if successful. |
| 204 CacheQueryResult QueryCacheForCharacteristic( | 203 CacheQueryResult QueryCacheForCharacteristic( |
| 205 const std::string& characteristic_instance_id); | 204 const std::string& characteristic_instance_id); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 mojo::Binding<blink::mojom::WebBluetoothService> binding_; | 246 mojo::Binding<blink::mojom::WebBluetoothService> binding_; |
| 248 | 247 |
| 249 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; | 248 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; |
| 250 | 249 |
| 251 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); | 250 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); |
| 252 }; | 251 }; |
| 253 | 252 |
| 254 } // namespace content | 253 } // namespace content |
| 255 | 254 |
| 256 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ | 255 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ |
| OLD | NEW |