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

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

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

Powered by Google App Engine
This is Rietveld 408576698