Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: content/browser/bluetooth/web_bluetooth_service_impl.h

Issue 2019853002: bluetooth: Use WebBluetoothDeviceId instead of string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uuid-typemap
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void NotifyCharacteristicValueChanged( 91 void NotifyCharacteristicValueChanged(
92 const std::string& characteristic_instance_id, 92 const std::string& characteristic_instance_id,
93 std::vector<uint8_t> value); 93 std::vector<uint8_t> value);
94 94
95 // WebBluetoothService methods: 95 // WebBluetoothService methods:
96 void SetClient( 96 void SetClient(
97 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override; 97 blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override;
98 void RequestDevice(blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, 98 void RequestDevice(blink::mojom::WebBluetoothRequestDeviceOptionsPtr options,
99 const RequestDeviceCallback& callback) override; 99 const RequestDeviceCallback& callback) override;
100 void RemoteServerConnect( 100 void RemoteServerConnect(
101 const mojo::String& device_id, 101 const WebBluetoothDeviceId& device_id,
102 const RemoteServerConnectCallback& callback) override; 102 const RemoteServerConnectCallback& callback) override;
103 void RemoteServerDisconnect(const mojo::String& device_id) override; 103 void RemoteServerDisconnect(const WebBluetoothDeviceId& device_id) override;
104 void RemoteServerGetPrimaryServices( 104 void RemoteServerGetPrimaryServices(
105 const mojo::String& device_id, 105 const WebBluetoothDeviceId& device_id,
106 blink::mojom::WebBluetoothGATTQueryQuantity quantity, 106 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
107 const base::Optional<device::BluetoothUUID>& services_uuid, 107 const base::Optional<device::BluetoothUUID>& service_uuid,
108 const RemoteServerGetPrimaryServicesCallback& callback) override; 108 const RemoteServerGetPrimaryServicesCallback& callback) override;
109 void RemoteServiceGetCharacteristics( 109 void RemoteServiceGetCharacteristics(
110 const mojo::String& service_instance_id, 110 const mojo::String& service_instance_id,
111 blink::mojom::WebBluetoothGATTQueryQuantity quantity, 111 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
112 const base::Optional<device::BluetoothUUID>& characteristics_uuid, 112 const base::Optional<device::BluetoothUUID>& characteristics_uuid,
113 const RemoteServiceGetCharacteristicsCallback& callback) override; 113 const RemoteServiceGetCharacteristicsCallback& callback) override;
114 void RemoteCharacteristicReadValue( 114 void RemoteCharacteristicReadValue(
115 const mojo::String& characteristic_instance_id, 115 const mojo::String& characteristic_instance_id,
116 const RemoteCharacteristicReadValueCallback& callback) override; 116 const RemoteCharacteristicReadValueCallback& callback) override;
117 void RemoteCharacteristicWriteValue( 117 void RemoteCharacteristicWriteValue(
118 const mojo::String& characteristic_instance_id, 118 const mojo::String& characteristic_instance_id,
119 mojo::Array<uint8_t> value, 119 mojo::Array<uint8_t> value,
120 const RemoteCharacteristicWriteValueCallback& callback) override; 120 const RemoteCharacteristicWriteValueCallback& callback) override;
121 void RemoteCharacteristicStartNotifications( 121 void RemoteCharacteristicStartNotifications(
122 const mojo::String& characteristic_instance_id, 122 const mojo::String& characteristic_instance_id,
123 const RemoteCharacteristicStartNotificationsCallback& callback) override; 123 const RemoteCharacteristicStartNotificationsCallback& callback) override;
124 void RemoteCharacteristicStopNotifications( 124 void RemoteCharacteristicStopNotifications(
125 const mojo::String& characteristic_instance_id, 125 const mojo::String& characteristic_instance_id,
126 const RemoteCharacteristicStopNotificationsCallback& callback) override; 126 const RemoteCharacteristicStopNotificationsCallback& callback) override;
127 127
128 void RequestDeviceImpl( 128 void RequestDeviceImpl(
129 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, 129 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options,
130 const RequestDeviceCallback& callback, 130 const RequestDeviceCallback& callback,
131 device::BluetoothAdapter* adapter); 131 device::BluetoothAdapter* adapter);
132 132
133 // Should only be run after the services have been discovered for 133 // Should only be run after the services have been discovered for
134 // |device_address|. 134 // |device_address|.
135 void RemoteServerGetPrimaryServicesImpl( 135 void RemoteServerGetPrimaryServicesImpl(
136 const mojo::String& device_id, 136 const WebBluetoothDeviceId& device_id,
137 blink::mojom::WebBluetoothGATTQueryQuantity quantity, 137 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
138 const base::Optional<device::BluetoothUUID>& services_uuid, 138 const base::Optional<device::BluetoothUUID>& services_uuid,
139 const RemoteServerGetPrimaryServicesCallback& callback, 139 const RemoteServerGetPrimaryServicesCallback& callback,
140 device::BluetoothDevice* device); 140 device::BluetoothDevice* device);
141 141
142 // Callbacks for BluetoothDeviceChooserController::GetDevice. 142 // Callbacks for BluetoothDeviceChooserController::GetDevice.
143 void OnGetDeviceSuccess( 143 void OnGetDeviceSuccess(
144 const RequestDeviceCallback& callback, 144 const RequestDeviceCallback& callback,
145 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, 145 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options,
146 const std::string& device_id); 146 const std::string& device_id);
147 void OnGetDeviceFailed(const RequestDeviceCallback& callback, 147 void OnGetDeviceFailed(const RequestDeviceCallback& callback,
148 blink::mojom::WebBluetoothError error); 148 blink::mojom::WebBluetoothError error);
149 149
150 // Callbacks for BluetoothDevice::CreateGattConnection. 150 // Callbacks for BluetoothDevice::CreateGattConnection.
151 void OnCreateGATTConnectionSuccess( 151 void OnCreateGATTConnectionSuccess(
152 const std::string& device_id, 152 const WebBluetoothDeviceId& device_id,
153 base::TimeTicks start_time, 153 base::TimeTicks start_time,
154 const RemoteServerConnectCallback& callback, 154 const RemoteServerConnectCallback& callback,
155 std::unique_ptr<device::BluetoothGattConnection> connection); 155 std::unique_ptr<device::BluetoothGattConnection> connection);
156 void OnCreateGATTConnectionFailed( 156 void OnCreateGATTConnectionFailed(
157 const std::string& device_id,
158 base::TimeTicks start_time, 157 base::TimeTicks start_time,
159 const RemoteServerConnectCallback& callback, 158 const RemoteServerConnectCallback& callback,
160 device::BluetoothDevice::ConnectErrorCode error_code); 159 device::BluetoothDevice::ConnectErrorCode error_code);
161 160
162 // Callbacks for BluetoothRemoteGattCharacteristic::ReadRemoteCharacteristic. 161 // Callbacks for BluetoothRemoteGattCharacteristic::ReadRemoteCharacteristic.
163 void OnReadValueSuccess(const RemoteCharacteristicReadValueCallback& callback, 162 void OnReadValueSuccess(const RemoteCharacteristicReadValueCallback& callback,
164 const std::vector<uint8_t>& value); 163 const std::vector<uint8_t>& value);
165 void OnReadValueFailed( 164 void OnReadValueFailed(
166 const RemoteCharacteristicReadValueCallback& callback, 165 const RemoteCharacteristicReadValueCallback& callback,
167 device::BluetoothRemoteGattService::GattErrorCode error_code); 166 device::BluetoothRemoteGattService::GattErrorCode error_code);
(...skipping 21 matching lines...) Expand all
189 // Functions to query the platform cache for the bluetooth object. 188 // Functions to query the platform cache for the bluetooth object.
190 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the 189 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the
191 // cache. Otherwise result.outcome that can used to record the outcome and 190 // cache. Otherwise result.outcome that can used to record the outcome and
192 // result.error will contain the error that should be sent to the renderer. 191 // result.error will contain the error that should be sent to the renderer.
193 // One of the possible outcomes is BAD_RENDERER. In this case we crash the 192 // One of the possible outcomes is BAD_RENDERER. In this case we crash the
194 // renderer, record the reason and close the pipe, so it's safe to drop 193 // renderer, record the reason and close the pipe, so it's safe to drop
195 // any callbacks. 194 // any callbacks.
196 195
197 // Queries the platform cache for a Device with |device_id| for |origin|. 196 // Queries the platform cache for a Device with |device_id| for |origin|.
198 // Fills in the |outcome| field and the |device| field if successful. 197 // Fills in the |outcome| field and the |device| field if successful.
199 CacheQueryResult QueryCacheForDevice(const std::string& device_id); 198 CacheQueryResult QueryCacheForDevice(const WebBluetoothDeviceId& device_id);
200 199
201 // Queries the platform cache for a Service with |service_instance_id|. Fills 200 // Queries the platform cache for a Service with |service_instance_id|. Fills
202 // in the |outcome| field, and |device| and |service| fields if successful. 201 // in the |outcome| field, and |device| and |service| fields if successful.
203 CacheQueryResult QueryCacheForService(const std::string& service_instance_id); 202 CacheQueryResult QueryCacheForService(const std::string& service_instance_id);
204 203
205 // Queries the platform cache for a characteristic with 204 // Queries the platform cache for a characteristic with
206 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|, 205 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|,
207 // |service| and |characteristic| fields if successful. 206 // |service| and |characteristic| fields if successful.
208 CacheQueryResult QueryCacheForCharacteristic( 207 CacheQueryResult QueryCacheForCharacteristic(
209 const std::string& characteristic_instance_id); 208 const std::string& characteristic_instance_id);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 mojo::Binding<blink::mojom::WebBluetoothService> binding_; 249 mojo::Binding<blink::mojom::WebBluetoothService> binding_;
251 250
252 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; 251 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_;
253 252
254 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); 253 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl);
255 }; 254 };
256 255
257 } // namespace content 256 } // namespace content
258 257
259 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 258 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698