OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_to_device_, characteristic_to_service_, | 7 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_, |
8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer | 8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer |
9 // obtains the corresponding ID from this class and it will be added to the map | 9 // obtains the corresponding ID from this class and it will be added to the map |
10 // at that time. | 10 // at that time. |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
859 return; | 859 return; |
860 } | 860 } |
861 | 861 |
862 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { | 862 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { |
863 RecordCharacteristicReadValueOutcome(query_result.outcome); | 863 RecordCharacteristicReadValueOutcome(query_result.outcome); |
864 Send(new BluetoothMsg_ReadCharacteristicValueError( | 864 Send(new BluetoothMsg_ReadCharacteristicValueError( |
865 thread_id, request_id, query_result.GetWebError())); | 865 thread_id, request_id, query_result.GetWebError())); |
866 return; | 866 return; |
867 } | 867 } |
868 | 868 |
869 if (BluetoothBlacklist::Get().IsExcludedFromReads( | |
870 query_result.characteristic->GetUUID())) { | |
871 RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome::BLACKLISTED); | |
ortuno
2016/02/26 00:07:11
Any reason why you put read/write in the same hist
scheib
2016/02/26 00:49:49
Same histogram enumeration, but different histogra
| |
872 Send(new BluetoothMsg_ReadCharacteristicValueError( | |
873 thread_id, request_id, WebBluetoothError::BlacklistedRead)); | |
874 return; | |
875 } | |
876 | |
869 query_result.characteristic->ReadRemoteCharacteristic( | 877 query_result.characteristic->ReadRemoteCharacteristic( |
870 base::Bind(&BluetoothDispatcherHost::OnCharacteristicValueRead, | 878 base::Bind(&BluetoothDispatcherHost::OnCharacteristicValueRead, |
871 weak_ptr_on_ui_thread_, thread_id, request_id), | 879 weak_ptr_on_ui_thread_, thread_id, request_id), |
872 base::Bind(&BluetoothDispatcherHost::OnCharacteristicReadValueError, | 880 base::Bind(&BluetoothDispatcherHost::OnCharacteristicReadValueError, |
873 weak_ptr_on_ui_thread_, thread_id, request_id)); | 881 weak_ptr_on_ui_thread_, thread_id, request_id)); |
874 } | 882 } |
875 | 883 |
876 void BluetoothDispatcherHost::OnWriteValue( | 884 void BluetoothDispatcherHost::OnWriteValue( |
877 int thread_id, | 885 int thread_id, |
878 int request_id, | 886 int request_id, |
(...skipping 22 matching lines...) Expand all Loading... | |
901 return; | 909 return; |
902 } | 910 } |
903 | 911 |
904 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { | 912 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { |
905 RecordCharacteristicWriteValueOutcome(query_result.outcome); | 913 RecordCharacteristicWriteValueOutcome(query_result.outcome); |
906 Send(new BluetoothMsg_WriteCharacteristicValueError( | 914 Send(new BluetoothMsg_WriteCharacteristicValueError( |
907 thread_id, request_id, query_result.GetWebError())); | 915 thread_id, request_id, query_result.GetWebError())); |
908 return; | 916 return; |
909 } | 917 } |
910 | 918 |
919 if (BluetoothBlacklist::Get().IsExcludedFromWrites( | |
920 query_result.characteristic->GetUUID())) { | |
921 RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome::BLACKLISTED); | |
922 Send(new BluetoothMsg_WriteCharacteristicValueError( | |
923 thread_id, request_id, WebBluetoothError::BlacklistedWrite)); | |
924 return; | |
925 } | |
926 | |
911 query_result.characteristic->WriteRemoteCharacteristic( | 927 query_result.characteristic->WriteRemoteCharacteristic( |
912 value, base::Bind(&BluetoothDispatcherHost::OnWriteValueSuccess, | 928 value, base::Bind(&BluetoothDispatcherHost::OnWriteValueSuccess, |
913 weak_ptr_on_ui_thread_, thread_id, request_id), | 929 weak_ptr_on_ui_thread_, thread_id, request_id), |
914 base::Bind(&BluetoothDispatcherHost::OnWriteValueFailed, | 930 base::Bind(&BluetoothDispatcherHost::OnWriteValueFailed, |
915 weak_ptr_on_ui_thread_, thread_id, request_id)); | 931 weak_ptr_on_ui_thread_, thread_id, request_id)); |
916 } | 932 } |
917 | 933 |
918 void BluetoothDispatcherHost::OnStartNotifications( | 934 void BluetoothDispatcherHost::OnStartNotifications( |
919 int thread_id, | 935 int thread_id, |
920 int request_id, | 936 int request_id, |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1541 | 1557 |
1542 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( | 1558 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( |
1543 int frame_routing_id, | 1559 int frame_routing_id, |
1544 const std::string& characteristic_instance_id) { | 1560 const std::string& characteristic_instance_id) { |
1545 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), | 1561 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), |
1546 characteristic_instance_id) | 1562 characteristic_instance_id) |
1547 .outcome != CacheQueryOutcome::BAD_RENDERER; | 1563 .outcome != CacheQueryOutcome::BAD_RENDERER; |
1548 } | 1564 } |
1549 | 1565 |
1550 } // namespace content | 1566 } // namespace content |
OLD | NEW |