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: A service, characteristic, or descriptor ID not in the |
6 // A service, characteristic, or descriptor ID not in the corresponding | 6 // corresponding WebBluetoothServiceImpl map [service_id_to_device_address_, |
7 // WebBluetoothServiceImpl map [service_id_to_device_address_, | 7 // characteristic_id_to_service_id_, descriptor_id_to_characteristic_id_] |
8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a | 8 // implies a hostile renderer because a renderer obtains the corresponding ID |
9 // hostile renderer because a renderer obtains the corresponding ID from this | 9 // from this 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. | |
11 | 10 |
12 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" | 11 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" |
13 | 12 |
14 #include <algorithm> | 13 #include <algorithm> |
15 | 14 |
16 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
18 #include "content/browser/bluetooth/bluetooth_blocklist.h" | 17 #include "content/browser/bluetooth/bluetooth_blocklist.h" |
19 #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h" | 18 #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h" |
20 #include "content/browser/bluetooth/bluetooth_metrics.h" | 19 #include "content/browser/bluetooth/bluetooth_metrics.h" |
21 #include "content/browser/bluetooth/frame_connected_bluetooth_devices.h" | 20 #include "content/browser/bluetooth/frame_connected_bluetooth_devices.h" |
22 #include "content/browser/renderer_host/render_process_host_impl.h" | 21 #include "content/browser/renderer_host/render_process_host_impl.h" |
23 #include "content/common/bluetooth/web_bluetooth_device_id.h" | 22 #include "content/common/bluetooth/web_bluetooth_device_id.h" |
24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/navigation_handle.h" | 24 #include "content/public/browser/navigation_handle.h" |
26 #include "content/public/browser/render_frame_host.h" | 25 #include "content/public/browser/render_frame_host.h" |
27 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
28 #include "device/bluetooth/bluetooth_adapter_factory_wrapper.h" | 27 #include "device/bluetooth/bluetooth_adapter_factory_wrapper.h" |
29 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 28 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
29 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | |
30 | 30 |
31 using device::BluetoothAdapterFactoryWrapper; | 31 using device::BluetoothAdapterFactoryWrapper; |
32 using device::BluetoothUUID; | 32 using device::BluetoothUUID; |
33 | 33 |
34 namespace content { | 34 namespace content { |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 blink::mojom::WebBluetoothResult TranslateConnectErrorAndRecord( | 38 blink::mojom::WebBluetoothResult TranslateConnectErrorAndRecord( |
39 device::BluetoothDevice::ConnectErrorCode error_code) { | 39 device::BluetoothDevice::ConnectErrorCode error_code) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 UMAGATTOperationOutcome::NOT_PAIRED); | 122 UMAGATTOperationOutcome::NOT_PAIRED); |
123 return blink::mojom::WebBluetoothResult::GATT_NOT_PAIRED; | 123 return blink::mojom::WebBluetoothResult::GATT_NOT_PAIRED; |
124 case device::BluetoothRemoteGattService::GATT_ERROR_NOT_SUPPORTED: | 124 case device::BluetoothRemoteGattService::GATT_ERROR_NOT_SUPPORTED: |
125 RecordGATTOperationOutcome(operation, | 125 RecordGATTOperationOutcome(operation, |
126 UMAGATTOperationOutcome::NOT_SUPPORTED); | 126 UMAGATTOperationOutcome::NOT_SUPPORTED); |
127 return blink::mojom::WebBluetoothResult::GATT_NOT_SUPPORTED; | 127 return blink::mojom::WebBluetoothResult::GATT_NOT_SUPPORTED; |
128 } | 128 } |
129 NOTREACHED(); | 129 NOTREACHED(); |
130 return blink::mojom::WebBluetoothResult::GATT_UNTRANSLATED_ERROR_CODE; | 130 return blink::mojom::WebBluetoothResult::GATT_UNTRANSLATED_ERROR_CODE; |
131 } | 131 } |
132 std::vector<device::BluetoothRemoteGattDescriptor*> GetDescriptorsByUUID( | |
133 device::BluetoothRemoteGattCharacteristic* characteristic, | |
134 const BluetoothUUID& descriptor_uuid) { | |
135 std::vector<device::BluetoothRemoteGattDescriptor*> descriptors; | |
136 VLOG(1) << "Looking for descriptor: " << descriptor_uuid.canonical_value(); | |
dcheng
2016/12/29 09:07:18
DVLOG
dougt
2017/01/12 19:38:16
Other logging messages in this file use VLOG().
dcheng
2017/01/13 09:28:42
They should be changed to DVLOG unless there's a g
| |
137 for (device::BluetoothRemoteGattDescriptor* descriptor : | |
138 characteristic->GetDescriptors()) { | |
139 VLOG(1) << "Descriptor in cache: " | |
dcheng
2016/12/29 09:07:18
Ditto: DVLOG
dougt
2017/01/12 19:38:16
Acknowledged.
dougt
2017/01/13 20:08:03
I am removing the VLOG in this directory in:
h
| |
140 << descriptor->GetUUID().canonical_value(); | |
141 if (descriptor->GetUUID() == descriptor_uuid) { | |
142 descriptors.push_back(descriptor); | |
143 } | |
144 } | |
145 return descriptors; | |
146 } | |
132 | 147 |
133 // TODO(ortuno): This should really be a BluetoothDevice method. | 148 // TODO(ortuno): This should really be a BluetoothDevice method. |
134 // Replace when implemented. http://crbug.com/552022 | 149 // Replace when implemented. http://crbug.com/552022 |
135 std::vector<device::BluetoothRemoteGattCharacteristic*> | 150 std::vector<device::BluetoothRemoteGattCharacteristic*> |
136 GetCharacteristicsByUUID(device::BluetoothRemoteGattService* service, | 151 GetCharacteristicsByUUID(device::BluetoothRemoteGattService* service, |
137 const BluetoothUUID& characteristic_uuid) { | 152 const BluetoothUUID& characteristic_uuid) { |
138 std::vector<device::BluetoothRemoteGattCharacteristic*> characteristics; | 153 std::vector<device::BluetoothRemoteGattCharacteristic*> characteristics; |
139 VLOG(1) << "Looking for characteristic: " | 154 VLOG(1) << "Looking for characteristic: " |
140 << characteristic_uuid.canonical_value(); | 155 << characteristic_uuid.canonical_value(); |
141 for (device::BluetoothRemoteGattCharacteristic* characteristic : | 156 for (device::BluetoothRemoteGattCharacteristic* characteristic : |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 RecordGetCharacteristicsOutcome( | 548 RecordGetCharacteristicsOutcome( |
534 quantity, characteristics_uuid | 549 quantity, characteristics_uuid |
535 ? UMAGetCharacteristicOutcome::NOT_FOUND | 550 ? UMAGetCharacteristicOutcome::NOT_FOUND |
536 : UMAGetCharacteristicOutcome::NO_CHARACTERISTICS); | 551 : UMAGetCharacteristicOutcome::NO_CHARACTERISTICS); |
537 callback.Run(characteristics_uuid | 552 callback.Run(characteristics_uuid |
538 ? blink::mojom::WebBluetoothResult::CHARACTERISTIC_NOT_FOUND | 553 ? blink::mojom::WebBluetoothResult::CHARACTERISTIC_NOT_FOUND |
539 : blink::mojom::WebBluetoothResult::NO_CHARACTERISTICS_FOUND, | 554 : blink::mojom::WebBluetoothResult::NO_CHARACTERISTICS_FOUND, |
540 base::nullopt /* characteristics */); | 555 base::nullopt /* characteristics */); |
541 } | 556 } |
542 | 557 |
558 void WebBluetoothServiceImpl::RemoteCharacteristicGetDescriptors( | |
559 const std::string& characteristic_instance_id, | |
560 blink::mojom::WebBluetoothGATTQueryQuantity quantity, | |
561 const base::Optional<BluetoothUUID>& descriptors_uuid, | |
562 const RemoteCharacteristicGetDescriptorsCallback& callback) { | |
563 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
564 | |
565 if (descriptors_uuid && | |
566 BluetoothBlocklist::Get().IsExcluded(descriptors_uuid.value())) { | |
567 callback.Run(blink::mojom::WebBluetoothResult::BLOCKLISTED_DESCRIPTOR_UUID, | |
568 base::nullopt /* descriptor */); | |
569 return; | |
570 } | |
571 | |
572 const CacheQueryResult query_result = | |
573 QueryCacheForCharacteristic(characteristic_instance_id); | |
574 | |
575 if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) { | |
576 return; | |
577 } | |
578 | |
579 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { | |
580 callback.Run(query_result.GetWebResult(), base::nullopt /* descriptor */); | |
581 return; | |
582 } | |
583 | |
584 std::vector<device::BluetoothRemoteGattDescriptor*> descriptors = | |
585 descriptors_uuid ? GetDescriptorsByUUID(query_result.characteristic, | |
586 descriptors_uuid.value()) | |
587 : query_result.characteristic->GetDescriptors(); | |
588 | |
589 std::vector<blink::mojom::WebBluetoothRemoteGATTDescriptorPtr> | |
590 response_descriptors; | |
591 for (device::BluetoothRemoteGattDescriptor* descriptor : descriptors) { | |
592 if (BluetoothBlocklist::Get().IsExcluded(descriptor->GetUUID())) { | |
593 continue; | |
594 } | |
595 std::string descriptor_instance_id = descriptor->GetIdentifier(); | |
596 | |
597 auto insert_result = descriptor_id_to_characteristic_id_.insert( | |
598 {descriptor_instance_id, characteristic_instance_id}); | |
599 // If value is already in map, DCHECK it's valid. | |
600 if (!insert_result.second) | |
601 DCHECK(insert_result.first->second == characteristic_instance_id); | |
602 | |
603 blink::mojom::WebBluetoothRemoteGATTDescriptorPtr descriptor_ptr = | |
604 blink::mojom::WebBluetoothRemoteGATTDescriptor::New(); | |
605 | |
606 descriptor_ptr->instance_id = descriptor_instance_id; | |
607 descriptor_ptr->uuid = descriptor->GetUUID().canonical_value(); | |
dcheng
2016/12/29 09:07:18
Please use a typemap for this, rather than buildin
dougt
2017/01/12 19:38:16
We'll do this in a follow up.
dougt
2017/01/12 19:38:16
We will do this in a follow. dcheng will send mai
| |
608 response_descriptors.push_back(std::move(descriptor_ptr)); | |
609 | |
610 if (quantity == blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE) { | |
611 break; | |
612 } | |
613 } | |
614 | |
615 if (!response_descriptors.empty()) { | |
616 callback.Run(blink::mojom::WebBluetoothResult::SUCCESS, | |
617 std::move(response_descriptors)); | |
618 return; | |
619 } | |
620 | |
621 callback.Run(descriptors_uuid | |
622 ? blink::mojom::WebBluetoothResult::DESCRIPTOR_NOT_FOUND | |
623 : blink::mojom::WebBluetoothResult::NO_DESCRIPTORS_FOUND, | |
624 base::nullopt /* descriptors */); | |
625 } | |
626 | |
543 void WebBluetoothServiceImpl::RemoteCharacteristicReadValue( | 627 void WebBluetoothServiceImpl::RemoteCharacteristicReadValue( |
544 const std::string& characteristic_instance_id, | 628 const std::string& characteristic_instance_id, |
545 const RemoteCharacteristicReadValueCallback& callback) { | 629 const RemoteCharacteristicReadValueCallback& callback) { |
546 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 630 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
547 RecordWebBluetoothFunctionCall( | 631 RecordWebBluetoothFunctionCall( |
548 UMAWebBluetoothFunction::CHARACTERISTIC_READ_VALUE); | 632 UMAWebBluetoothFunction::CHARACTERISTIC_READ_VALUE); |
549 | 633 |
550 const CacheQueryResult query_result = | 634 const CacheQueryResult query_result = |
551 QueryCacheForCharacteristic(characteristic_instance_id); | 635 QueryCacheForCharacteristic(characteristic_instance_id); |
552 | 636 |
553 if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) { | 637 if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) { |
554 return; | 638 return; |
555 } | 639 } |
556 | 640 |
557 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { | 641 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { |
558 RecordCharacteristicReadValueOutcome(query_result.outcome); | 642 RecordCharacteristicReadValueOutcome(query_result.outcome); |
559 callback.Run(query_result.GetWebResult(), base::nullopt /* value */); | 643 callback.Run(query_result.GetWebResult(), base::nullopt /* value */); |
560 return; | 644 return; |
561 } | 645 } |
562 | 646 |
563 if (BluetoothBlocklist::Get().IsExcludedFromReads( | 647 if (BluetoothBlocklist::Get().IsExcludedFromReads( |
564 query_result.characteristic->GetUUID())) { | 648 query_result.characteristic->GetUUID())) { |
565 RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome::BLOCKLISTED); | 649 RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome::BLOCKLISTED); |
566 callback.Run(blink::mojom::WebBluetoothResult::BLOCKLISTED_READ, | 650 callback.Run(blink::mojom::WebBluetoothResult::BLOCKLISTED_READ, |
567 base::nullopt /* value */); | 651 base::nullopt /* value */); |
568 return; | 652 return; |
569 } | 653 } |
570 | 654 |
571 query_result.characteristic->ReadRemoteCharacteristic( | 655 query_result.characteristic->ReadRemoteCharacteristic( |
572 base::Bind(&WebBluetoothServiceImpl::OnReadValueSuccess, | 656 base::Bind(&WebBluetoothServiceImpl::OnCharacteristicReadValueSuccess, |
573 weak_ptr_factory_.GetWeakPtr(), callback), | 657 weak_ptr_factory_.GetWeakPtr(), callback), |
574 base::Bind(&WebBluetoothServiceImpl::OnReadValueFailed, | 658 base::Bind(&WebBluetoothServiceImpl::OnCharacteristicReadValueFailed, |
575 weak_ptr_factory_.GetWeakPtr(), callback)); | 659 weak_ptr_factory_.GetWeakPtr(), callback)); |
576 } | 660 } |
577 | 661 |
578 void WebBluetoothServiceImpl::RemoteCharacteristicWriteValue( | 662 void WebBluetoothServiceImpl::RemoteCharacteristicWriteValue( |
579 const std::string& characteristic_instance_id, | 663 const std::string& characteristic_instance_id, |
580 const std::vector<uint8_t>& value, | 664 const std::vector<uint8_t>& value, |
581 const RemoteCharacteristicWriteValueCallback& callback) { | 665 const RemoteCharacteristicWriteValueCallback& callback) { |
582 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 666 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
583 RecordWebBluetoothFunctionCall( | 667 RecordWebBluetoothFunctionCall( |
584 UMAWebBluetoothFunction::CHARACTERISTIC_WRITE_VALUE); | 668 UMAWebBluetoothFunction::CHARACTERISTIC_WRITE_VALUE); |
(...skipping 20 matching lines...) Expand all Loading... | |
605 } | 689 } |
606 | 690 |
607 if (BluetoothBlocklist::Get().IsExcludedFromWrites( | 691 if (BluetoothBlocklist::Get().IsExcludedFromWrites( |
608 query_result.characteristic->GetUUID())) { | 692 query_result.characteristic->GetUUID())) { |
609 RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome::BLOCKLISTED); | 693 RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome::BLOCKLISTED); |
610 callback.Run(blink::mojom::WebBluetoothResult::BLOCKLISTED_WRITE); | 694 callback.Run(blink::mojom::WebBluetoothResult::BLOCKLISTED_WRITE); |
611 return; | 695 return; |
612 } | 696 } |
613 | 697 |
614 query_result.characteristic->WriteRemoteCharacteristic( | 698 query_result.characteristic->WriteRemoteCharacteristic( |
615 value, base::Bind(&WebBluetoothServiceImpl::OnWriteValueSuccess, | 699 value, |
616 weak_ptr_factory_.GetWeakPtr(), callback), | 700 base::Bind(&WebBluetoothServiceImpl::OnCharacteristicWriteValueSuccess, |
617 base::Bind(&WebBluetoothServiceImpl::OnWriteValueFailed, | 701 weak_ptr_factory_.GetWeakPtr(), callback), |
702 base::Bind(&WebBluetoothServiceImpl::OnCharacteristicWriteValueFailed, | |
618 weak_ptr_factory_.GetWeakPtr(), callback)); | 703 weak_ptr_factory_.GetWeakPtr(), callback)); |
619 } | 704 } |
620 | 705 |
621 void WebBluetoothServiceImpl::RemoteCharacteristicStartNotifications( | 706 void WebBluetoothServiceImpl::RemoteCharacteristicStartNotifications( |
622 const std::string& characteristic_instance_id, | 707 const std::string& characteristic_instance_id, |
623 const RemoteCharacteristicStartNotificationsCallback& callback) { | 708 const RemoteCharacteristicStartNotificationsCallback& callback) { |
624 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 709 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
625 RecordWebBluetoothFunctionCall( | 710 RecordWebBluetoothFunctionCall( |
626 UMAWebBluetoothFunction::CHARACTERISTIC_START_NOTIFICATIONS); | 711 UMAWebBluetoothFunction::CHARACTERISTIC_START_NOTIFICATIONS); |
627 | 712 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 | 909 |
825 void WebBluetoothServiceImpl::OnCreateGATTConnectionFailed( | 910 void WebBluetoothServiceImpl::OnCreateGATTConnectionFailed( |
826 base::TimeTicks start_time, | 911 base::TimeTicks start_time, |
827 const RemoteServerConnectCallback& callback, | 912 const RemoteServerConnectCallback& callback, |
828 device::BluetoothDevice::ConnectErrorCode error_code) { | 913 device::BluetoothDevice::ConnectErrorCode error_code) { |
829 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 914 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
830 RecordConnectGATTTimeFailed(base::TimeTicks::Now() - start_time); | 915 RecordConnectGATTTimeFailed(base::TimeTicks::Now() - start_time); |
831 callback.Run(TranslateConnectErrorAndRecord(error_code)); | 916 callback.Run(TranslateConnectErrorAndRecord(error_code)); |
832 } | 917 } |
833 | 918 |
834 void WebBluetoothServiceImpl::OnReadValueSuccess( | 919 void WebBluetoothServiceImpl::OnCharacteristicReadValueSuccess( |
835 const RemoteCharacteristicReadValueCallback& callback, | 920 const RemoteCharacteristicReadValueCallback& callback, |
836 const std::vector<uint8_t>& value) { | 921 const std::vector<uint8_t>& value) { |
837 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 922 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
838 RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome::SUCCESS); | 923 RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome::SUCCESS); |
839 callback.Run(blink::mojom::WebBluetoothResult::SUCCESS, value); | 924 callback.Run(blink::mojom::WebBluetoothResult::SUCCESS, value); |
840 } | 925 } |
841 | 926 |
842 void WebBluetoothServiceImpl::OnReadValueFailed( | 927 void WebBluetoothServiceImpl::OnCharacteristicReadValueFailed( |
843 const RemoteCharacteristicReadValueCallback& callback, | 928 const RemoteCharacteristicReadValueCallback& callback, |
844 device::BluetoothRemoteGattService::GattErrorCode error_code) { | 929 device::BluetoothRemoteGattService::GattErrorCode error_code) { |
845 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 930 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
846 callback.Run(TranslateGATTErrorAndRecord( | 931 callback.Run(TranslateGATTErrorAndRecord( |
847 error_code, UMAGATTOperation::CHARACTERISTIC_READ), | 932 error_code, UMAGATTOperation::CHARACTERISTIC_READ), |
848 base::nullopt /* value */); | 933 base::nullopt /* value */); |
849 } | 934 } |
850 | 935 |
851 void WebBluetoothServiceImpl::OnWriteValueSuccess( | 936 void WebBluetoothServiceImpl::OnCharacteristicWriteValueSuccess( |
852 const RemoteCharacteristicWriteValueCallback& callback) { | 937 const RemoteCharacteristicWriteValueCallback& callback) { |
853 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 938 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
854 RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome::SUCCESS); | 939 RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome::SUCCESS); |
855 callback.Run(blink::mojom::WebBluetoothResult::SUCCESS); | 940 callback.Run(blink::mojom::WebBluetoothResult::SUCCESS); |
856 } | 941 } |
857 | 942 |
858 void WebBluetoothServiceImpl::OnWriteValueFailed( | 943 void WebBluetoothServiceImpl::OnCharacteristicWriteValueFailed( |
859 const RemoteCharacteristicWriteValueCallback& callback, | 944 const RemoteCharacteristicWriteValueCallback& callback, |
860 device::BluetoothRemoteGattService::GattErrorCode error_code) { | 945 device::BluetoothRemoteGattService::GattErrorCode error_code) { |
861 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 946 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
862 callback.Run(TranslateGATTErrorAndRecord( | 947 callback.Run(TranslateGATTErrorAndRecord( |
863 error_code, UMAGATTOperation::CHARACTERISTIC_WRITE)); | 948 error_code, UMAGATTOperation::CHARACTERISTIC_WRITE)); |
864 } | 949 } |
865 | 950 |
866 void WebBluetoothServiceImpl::OnStartNotifySessionSuccess( | 951 void WebBluetoothServiceImpl::OnStartNotifySessionSuccess( |
867 const RemoteCharacteristicStartNotificationsCallback& callback, | 952 const RemoteCharacteristicStartNotificationsCallback& callback, |
868 std::unique_ptr<device::BluetoothGattNotifySession> notify_session) { | 953 std::unique_ptr<device::BluetoothGattNotifySession> notify_session) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 binding_.Close(); | 1073 binding_.Close(); |
989 } | 1074 } |
990 | 1075 |
991 url::Origin WebBluetoothServiceImpl::GetOrigin() { | 1076 url::Origin WebBluetoothServiceImpl::GetOrigin() { |
992 return render_frame_host_->GetLastCommittedOrigin(); | 1077 return render_frame_host_->GetLastCommittedOrigin(); |
993 } | 1078 } |
994 | 1079 |
995 void WebBluetoothServiceImpl::ClearState() { | 1080 void WebBluetoothServiceImpl::ClearState() { |
996 characteristic_id_to_notify_session_.clear(); | 1081 characteristic_id_to_notify_session_.clear(); |
997 pending_primary_services_requests_.clear(); | 1082 pending_primary_services_requests_.clear(); |
1083 descriptor_id_to_characteristic_id_.clear(); | |
998 characteristic_id_to_service_id_.clear(); | 1084 characteristic_id_to_service_id_.clear(); |
999 service_id_to_device_address_.clear(); | 1085 service_id_to_device_address_.clear(); |
1000 connected_devices_.reset( | 1086 connected_devices_.reset( |
1001 new FrameConnectedBluetoothDevices(render_frame_host_)); | 1087 new FrameConnectedBluetoothDevices(render_frame_host_)); |
1002 allowed_devices_map_ = BluetoothAllowedDevicesMap(); | 1088 allowed_devices_map_ = BluetoothAllowedDevicesMap(); |
1003 device_chooser_controller_.reset(); | 1089 device_chooser_controller_.reset(); |
1004 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); | 1090 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); |
1005 } | 1091 } |
1006 | 1092 |
1007 } // namespace content | 1093 } // namespace content |
OLD | NEW |