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 // ID Not In Map Note: | 5 // ID Not In Map Note: |
6 // A service, characteristic, or descriptor ID not in the corresponding | 6 // A service, characteristic, or descriptor ID not in the corresponding |
7 // BluetoothDispatcherHost map [service_id_to_device_address_, | 7 // BluetoothDispatcherHost map [service_id_to_device_address_, |
8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a | 8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a |
9 // hostile renderer because a renderer obtains the corresponding ID from this | 9 // hostile renderer because a renderer obtains the corresponding ID from this |
10 // class and it will be added to the map at that time. | 10 // class and it will be added to the map at that time. |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 | 203 |
204 void WebBluetoothServiceImpl::DeviceChanged(device::BluetoothAdapter* adapter, | 204 void WebBluetoothServiceImpl::DeviceChanged(device::BluetoothAdapter* adapter, |
205 device::BluetoothDevice* device) { | 205 device::BluetoothDevice* device) { |
206 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 206 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
207 if (!device->IsGattConnected() || !device->IsConnected()) { | 207 if (!device->IsGattConnected() || !device->IsConnected()) { |
208 std::string device_id = | 208 std::string device_id = |
209 connected_devices_->CloseConnectionToDeviceWithAddress( | 209 connected_devices_->CloseConnectionToDeviceWithAddress( |
210 device->GetAddress()); | 210 device->GetAddress()); |
211 if (!device_id.empty()) { | 211 if (!device_id.empty()) { |
212 // TODO(ortuno): Send event to client. | 212 if (client_) { |
213 // http://crbug.com/581855 | 213 client_->GattServerDisconnected(device_id); |
| 214 } |
214 } | 215 } |
215 } | 216 } |
216 } | 217 } |
217 | 218 |
218 void WebBluetoothServiceImpl::GattServicesDiscovered( | 219 void WebBluetoothServiceImpl::GattServicesDiscovered( |
219 device::BluetoothAdapter* adapter, | 220 device::BluetoothAdapter* adapter, |
220 device::BluetoothDevice* device) { | 221 device::BluetoothDevice* device) { |
221 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 222 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
222 const std::string& device_address = device->GetAddress(); | 223 const std::string& device_address = device->GetAddress(); |
223 VLOG(1) << "Services discovered for device: " << device_address; | 224 VLOG(1) << "Services discovered for device: " << device_address; |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 void WebBluetoothServiceImpl::ClearState() { | 829 void WebBluetoothServiceImpl::ClearState() { |
829 characteristic_id_to_notify_session_.clear(); | 830 characteristic_id_to_notify_session_.clear(); |
830 pending_primary_services_requests_.clear(); | 831 pending_primary_services_requests_.clear(); |
831 characteristic_id_to_service_id_.clear(); | 832 characteristic_id_to_service_id_.clear(); |
832 service_id_to_device_address_.clear(); | 833 service_id_to_device_address_.clear(); |
833 connected_devices_.reset( | 834 connected_devices_.reset( |
834 new FrameConnectedBluetoothDevices(render_frame_host_)); | 835 new FrameConnectedBluetoothDevices(render_frame_host_)); |
835 } | 836 } |
836 | 837 |
837 } // namespace content | 838 } // namespace content |
OLD | NEW |