| 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> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/optional.h" |
| 13 #include "content/browser/bad_message.h" | 14 #include "content/browser/bad_message.h" |
| 14 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" | 15 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" |
| 15 #include "content/browser/bluetooth/cache_query_result.h" | 16 #include "content/browser/bluetooth/cache_query_result.h" |
| 16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "device/bluetooth/bluetooth_adapter.h" | 19 #include "device/bluetooth/bluetooth_adapter.h" |
| 19 #include "device/bluetooth/bluetooth_gatt_connection.h" | 20 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| 20 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 21 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
| 21 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 22 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 22 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 23 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void SetClient( | 95 void SetClient( |
| 95 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override; | 96 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override; |
| 96 void RequestDevice(blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, | 97 void RequestDevice(blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, |
| 97 const RequestDeviceCallback& callback) override; | 98 const RequestDeviceCallback& callback) override; |
| 98 void RemoteServerConnect( | 99 void RemoteServerConnect( |
| 99 const mojo::String& device_id, | 100 const mojo::String& device_id, |
| 100 const RemoteServerConnectCallback& callback) override; | 101 const RemoteServerConnectCallback& callback) override; |
| 101 void RemoteServerDisconnect(const mojo::String& device_id) override; | 102 void RemoteServerDisconnect(const mojo::String& device_id) override; |
| 102 void RemoteServerGetPrimaryService( | 103 void RemoteServerGetPrimaryService( |
| 103 const mojo::String& device_id, | 104 const mojo::String& device_id, |
| 104 const mojo::String& service_uuid, | 105 const base::Optional<device::BluetoothUUID>& service_uuid, |
| 105 const RemoteServerGetPrimaryServiceCallback& callback) override; | 106 const RemoteServerGetPrimaryServiceCallback& callback) override; |
| 106 void RemoteServiceGetCharacteristics( | 107 void RemoteServiceGetCharacteristics( |
| 107 const mojo::String& service_instance_id, | 108 const mojo::String& service_instance_id, |
| 108 blink::mojom::WebBluetoothGATTQueryQuantity quantity, | 109 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 109 const mojo::String& characteristics_uuid, | 110 const base::Optional<device::BluetoothUUID>& characteristics_uuid, |
| 110 const RemoteServiceGetCharacteristicsCallback& callback) override; | 111 const RemoteServiceGetCharacteristicsCallback& callback) override; |
| 111 void RemoteCharacteristicReadValue( | 112 void RemoteCharacteristicReadValue( |
| 112 const mojo::String& characteristic_instance_id, | 113 const mojo::String& characteristic_instance_id, |
| 113 const RemoteCharacteristicReadValueCallback& callback) override; | 114 const RemoteCharacteristicReadValueCallback& callback) override; |
| 114 void RemoteCharacteristicWriteValue( | 115 void RemoteCharacteristicWriteValue( |
| 115 const mojo::String& characteristic_instance_id, | 116 const mojo::String& characteristic_instance_id, |
| 116 mojo::Array<uint8_t> value, | 117 mojo::Array<uint8_t> value, |
| 117 const RemoteCharacteristicWriteValueCallback& callback) override; | 118 const RemoteCharacteristicWriteValueCallback& callback) override; |
| 118 void RemoteCharacteristicStartNotifications( | 119 void RemoteCharacteristicStartNotifications( |
| 119 const mojo::String& characteristic_instance_id, | 120 const mojo::String& characteristic_instance_id, |
| 120 const RemoteCharacteristicStartNotificationsCallback& callback) override; | 121 const RemoteCharacteristicStartNotificationsCallback& callback) override; |
| 121 void RemoteCharacteristicStopNotifications( | 122 void RemoteCharacteristicStopNotifications( |
| 122 const mojo::String& characteristic_instance_id, | 123 const mojo::String& characteristic_instance_id, |
| 123 const RemoteCharacteristicStopNotificationsCallback& callback) override; | 124 const RemoteCharacteristicStopNotificationsCallback& callback) override; |
| 124 | 125 |
| 125 void RequestDeviceImpl( | 126 void RequestDeviceImpl( |
| 126 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, | 127 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, |
| 127 const RequestDeviceCallback& callback, | 128 const RequestDeviceCallback& callback, |
| 128 device::BluetoothAdapter* adapter); | 129 device::BluetoothAdapter* adapter); |
| 129 | 130 |
| 130 // Should only be run after the services have been discovered for | 131 // Should only be run after the services have been discovered for |
| 131 // |device_address|. | 132 // |device_address|. |
| 132 void RemoteServerGetPrimaryServiceImpl( | 133 void RemoteServerGetPrimaryServiceImpl( |
| 133 const std::string& service_uuid, | 134 const base::Optional<device::BluetoothUUID>& service_uuid, |
| 134 const RemoteServerGetPrimaryServiceCallback& callback, | 135 const RemoteServerGetPrimaryServiceCallback& callback, |
| 135 device::BluetoothDevice* device); | 136 device::BluetoothDevice* device); |
| 136 | 137 |
| 137 // Callbacks for BluetoothDeviceChooserController::GetDevice. | 138 // Callbacks for BluetoothDeviceChooserController::GetDevice. |
| 138 void OnGetDeviceSuccess( | 139 void OnGetDeviceSuccess( |
| 139 const RequestDeviceCallback& callback, | 140 const RequestDeviceCallback& callback, |
| 140 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, | 141 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, |
| 141 const std::string& device_id); | 142 const std::string& device_id); |
| 142 void OnGetDeviceFailed(const RequestDeviceCallback& callback, | 143 void OnGetDeviceFailed(const RequestDeviceCallback& callback, |
| 143 blink::mojom::WebBluetoothError error); | 144 blink::mojom::WebBluetoothError error); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 mojo::Binding<blink::mojom::WebBluetoothService> binding_; | 247 mojo::Binding<blink::mojom::WebBluetoothService> binding_; |
| 247 | 248 |
| 248 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; | 249 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; |
| 249 | 250 |
| 250 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); | 251 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); |
| 251 }; | 252 }; |
| 252 | 253 |
| 253 } // namespace content | 254 } // namespace content |
| 254 | 255 |
| 255 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ | 256 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ |
| OLD | NEW |