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: A service, characteristic, or descriptor ID not in the | 5 // ID Not In Map Note: A service, characteristic, or descriptor ID not in the |
6 // corresponding WebBluetoothServiceImpl map [service_id_to_device_address_, | 6 // corresponding WebBluetoothServiceImpl map [service_id_to_device_address_, |
7 // characteristic_id_to_service_id_, descriptor_id_to_characteristic_id_] | 7 // characteristic_id_to_service_id_, descriptor_id_to_characteristic_id_] |
8 // implies a hostile renderer because a renderer obtains the corresponding ID | 8 // implies a hostile renderer because a renderer obtains the corresponding ID |
9 // from this class and it will be added to the map at that time. | 9 // from this class and it will be added to the map at that time. |
10 | 10 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) { | 522 if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) { |
523 return; | 523 return; |
524 } | 524 } |
525 | 525 |
526 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { | 526 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { |
527 RecordGetDescriptorsOutcome(quantity, query_result.outcome); | 527 RecordGetDescriptorsOutcome(quantity, query_result.outcome); |
528 callback.Run(query_result.GetWebResult(), base::nullopt /* descriptor */); | 528 callback.Run(query_result.GetWebResult(), base::nullopt /* descriptor */); |
529 return; | 529 return; |
530 } | 530 } |
531 | 531 |
532 auto descriptors = | 532 auto descriptors = descriptors_uuid |
533 descriptors_uuid | 533 ? query_result.characteristic->GetDescriptorsByUUID( |
534 ? query_result.device->GetDescriptorsByUUID( | 534 descriptors_uuid.value()) |
535 query_result.characteristic, descriptors_uuid.value()) | 535 : query_result.characteristic->GetDescriptors(); |
536 : query_result.characteristic->GetDescriptors(); | |
537 | 536 |
538 std::vector<blink::mojom::WebBluetoothRemoteGATTDescriptorPtr> | 537 std::vector<blink::mojom::WebBluetoothRemoteGATTDescriptorPtr> |
539 response_descriptors; | 538 response_descriptors; |
540 for (device::BluetoothRemoteGattDescriptor* descriptor : descriptors) { | 539 for (device::BluetoothRemoteGattDescriptor* descriptor : descriptors) { |
541 if (BluetoothBlocklist::Get().IsExcluded(descriptor->GetUUID())) { | 540 if (BluetoothBlocklist::Get().IsExcluded(descriptor->GetUUID())) { |
542 continue; | 541 continue; |
543 } | 542 } |
544 std::string descriptor_instance_id = descriptor->GetIdentifier(); | 543 std::string descriptor_instance_id = descriptor->GetIdentifier(); |
545 auto insert_result = descriptor_id_to_characteristic_id_.insert( | 544 auto insert_result = descriptor_id_to_characteristic_id_.insert( |
546 {descriptor_instance_id, characteristic_instance_id}); | 545 {descriptor_instance_id, characteristic_instance_id}); |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 descriptor_id_to_characteristic_id_.clear(); | 1186 descriptor_id_to_characteristic_id_.clear(); |
1188 characteristic_id_to_service_id_.clear(); | 1187 characteristic_id_to_service_id_.clear(); |
1189 service_id_to_device_address_.clear(); | 1188 service_id_to_device_address_.clear(); |
1190 connected_devices_.reset( | 1189 connected_devices_.reset( |
1191 new FrameConnectedBluetoothDevices(render_frame_host_)); | 1190 new FrameConnectedBluetoothDevices(render_frame_host_)); |
1192 device_chooser_controller_.reset(); | 1191 device_chooser_controller_.reset(); |
1193 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); | 1192 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); |
1194 } | 1193 } |
1195 | 1194 |
1196 } // namespace content | 1195 } // namespace content |
OLD | NEW |