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

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: move glucose UUID in code as well 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
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_metrics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
797 BluetoothUUID(characteristic_uuid))) {
798 RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::BLACKLISTED);
799 Send(new BluetoothMsg_GetCharacteristicError(
800 thread_id, request_id,
801 WebBluetoothError::BlacklistedCharacteristicUUID));
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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 1541
1532 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( 1542 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance(
1533 int frame_routing_id, 1543 int frame_routing_id,
1534 const std::string& characteristic_instance_id) { 1544 const std::string& characteristic_instance_id) {
1535 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), 1545 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id),
1536 characteristic_instance_id) 1546 characteristic_instance_id)
1537 .outcome != CacheQueryOutcome::BAD_RENDERER; 1547 .outcome != CacheQueryOutcome::BAD_RENDERER;
1538 } 1548 }
1539 1549
1540 } // namespace content 1550 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698