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

Unified Diff: content/browser/bluetooth/bluetooth_dispatcher_host.cc

Issue 1737423002: bluetooth: Add Web Bluetooth blacklist checks to readValue & writeValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-blacklist-char-
Patch Set: addressed ortuno 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/bluetooth_dispatcher_host.cc
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
index 22ad2c63fd955f1db5bb3032a2cc1020f01c2ff4..f783d31e6a768667f3bb4e1c466d1b382e1ad99f 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -866,6 +866,14 @@ void BluetoothDispatcherHost::OnReadValue(
return;
}
+ if (BluetoothBlacklist::Get().IsExcludedFromReads(
+ query_result.characteristic->GetUUID())) {
+ RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome::BLACKLISTED);
+ Send(new BluetoothMsg_ReadCharacteristicValueError(
+ thread_id, request_id, WebBluetoothError::BlacklistedRead));
+ return;
+ }
+
query_result.characteristic->ReadRemoteCharacteristic(
base::Bind(&BluetoothDispatcherHost::OnCharacteristicValueRead,
weak_ptr_on_ui_thread_, thread_id, request_id),
@@ -908,6 +916,14 @@ void BluetoothDispatcherHost::OnWriteValue(
return;
}
+ if (BluetoothBlacklist::Get().IsExcludedFromWrites(
+ query_result.characteristic->GetUUID())) {
+ RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome::BLACKLISTED);
+ Send(new BluetoothMsg_WriteCharacteristicValueError(
+ thread_id, request_id, WebBluetoothError::BlacklistedWrite));
+ return;
+ }
+
query_result.characteristic->WriteRemoteCharacteristic(
value, base::Bind(&BluetoothDispatcherHost::OnWriteValueSuccess,
weak_ptr_on_ui_thread_, thread_id, request_id),
« no previous file with comments | « content/browser/bluetooth/bluetooth_blacklist_unittest.cc ('k') | content/browser/bluetooth/bluetooth_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698