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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.cc

Issue 1697873002: bluetooth: Test Web Bluetooth getCharacteristic calls against blacklist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-blacklist-integration-
Patch Set: Created 4 years, 10 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 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 void BluetoothDispatcherHost::OnGetCharacteristic( 785 void BluetoothDispatcherHost::OnGetCharacteristic(
786 int thread_id, 786 int thread_id,
787 int request_id, 787 int request_id,
788 int frame_routing_id, 788 int frame_routing_id,
789 const std::string& service_instance_id, 789 const std::string& service_instance_id,
790 const std::string& characteristic_uuid) { 790 const std::string& characteristic_uuid) {
791 DCHECK_CURRENTLY_ON(BrowserThread::UI); 791 DCHECK_CURRENTLY_ON(BrowserThread::UI);
792 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::GET_CHARACTERISTIC); 792 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::GET_CHARACTERISTIC);
793 RecordGetCharacteristicCharacteristic(characteristic_uuid); 793 RecordGetCharacteristicCharacteristic(characteristic_uuid);
794 794
795 // Check Blacklist for characteristic_uuid.
796 if (BluetoothBlacklist::Get().IsExcluded(
ortuno 2016/02/23 22:37:58 You probably want to crash the renderer in QueryCa
scheib 2016/02/24 19:51:28 We discussed in person, and concluded that the ini
797 BluetoothUUID(characteristic_uuid))) {
798 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::BLACKLISTED);
799 Send(new BluetoothMsg_GetCharacteristicError(
800 thread_id, request_id,
801 WebBluetoothError::GetCharacteristicWithBlacklistedUUID));
802 return;
803 }
804
795 const CacheQueryResult query_result = 805 const CacheQueryResult query_result =
796 QueryCacheForService(GetOrigin(frame_routing_id), service_instance_id); 806 QueryCacheForService(GetOrigin(frame_routing_id), service_instance_id);
797 807
798 if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) { 808 if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) {
799 return; 809 return;
800 } 810 }
801 811
802 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { 812 if (query_result.outcome != CacheQueryOutcome::SUCCESS) {
803 RecordGetCharacteristicOutcome(query_result.outcome); 813 RecordGetCharacteristicOutcome(query_result.outcome);
804 Send(new BluetoothMsg_GetCharacteristicError(thread_id, request_id, 814 Send(new BluetoothMsg_GetCharacteristicError(thread_id, request_id,
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 1532
1523 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( 1533 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance(
1524 int frame_routing_id, 1534 int frame_routing_id,
1525 const std::string& characteristic_instance_id) { 1535 const std::string& characteristic_instance_id) {
1526 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), 1536 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id),
1527 characteristic_instance_id) 1537 characteristic_instance_id)
1528 .outcome != CacheQueryOutcome::BAD_RENDERER; 1538 .outcome != CacheQueryOutcome::BAD_RENDERER;
1529 } 1539 }
1530 1540
1531 } // namespace content 1541 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698