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

Side by Side Diff: content/browser/bluetooth/bluetooth_blacklist.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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_blacklist_unittest.cc » ('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 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 #include "content/browser/bluetooth/bluetooth_blacklist.h" 5 #include "content/browser/bluetooth/bluetooth_blacklist.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/bluetooth/bluetooth_scan_filter.h" 8 #include "content/common/bluetooth/bluetooth_scan_filter.h"
9 9
10 using device::BluetoothUUID; 10 using device::BluetoothUUID;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 BluetoothBlacklist::BluetoothBlacklist() { 88 BluetoothBlacklist::BluetoothBlacklist() {
89 PopulateWithDefaultValues(); 89 PopulateWithDefaultValues();
90 } 90 }
91 91
92 void BluetoothBlacklist::PopulateWithDefaultValues() { 92 void BluetoothBlacklist::PopulateWithDefaultValues() {
93 blacklisted_uuids_.clear(); 93 blacklisted_uuids_.clear();
94 94
95 // Blacklist UUIDs updated 2016-02-12 from: 95 // Blacklist UUIDs updated 2016-02-12 from:
96 // https://github.com/WebBluetoothCG/registries/blob/master/gatt_blacklist.txt 96 // https://github.com/WebBluetoothCG/registries/blob/master/gatt_blacklist.txt
97 // Short UUIDs are used for readability of this list. 97 // Short UUIDs are used for readability of this list.
98 //
99 // Testing from Layout Tests Note:
100 //
101 // Random UUIDs for object & exclude permutations that do not exist in the
102 // standard blacklist are included to facilitate integration testing from
103 // Layout Tests. Unit tests can dynamically modify the blacklist, but don't
104 // offer the full integration test to the Web Bluetooth Javascript bindings.
105 //
106 // This is done for simplicity as opposed to exposing a testing API that can
107 // add to the blacklist over time, which would be over engineered.
108 //
109 // Remove testing UUIDs if the specified blacklist is updated to include UUIDs
110 // that match the specific permutations.
98 DCHECK(BluetoothUUID("00001800-0000-1000-8000-00805f9b34fb") == 111 DCHECK(BluetoothUUID("00001800-0000-1000-8000-00805f9b34fb") ==
99 BluetoothUUID("1800")); 112 BluetoothUUID("1800"));
100 // ## Services 113 // Services:
101 AddOrDie(BluetoothUUID("1812"), Value::EXCLUDE); 114 AddOrDie(BluetoothUUID("1812"), Value::EXCLUDE);
102 // ## Characteristics 115 // Characteristics:
103 AddOrDie(BluetoothUUID("2a02"), Value::EXCLUDE_WRITES); 116 AddOrDie(BluetoothUUID("2a02"), Value::EXCLUDE_WRITES);
104 AddOrDie(BluetoothUUID("2a03"), Value::EXCLUDE); 117 AddOrDie(BluetoothUUID("2a03"), Value::EXCLUDE);
105 AddOrDie(BluetoothUUID("2a25"), Value::EXCLUDE); 118 AddOrDie(BluetoothUUID("2a25"), Value::EXCLUDE);
106 // ## Descriptors 119 // Characteristics for Layout Tests:
120 AddOrDie(BluetoothUUID("bad1c9a2-9a5b-4015-8b60-1579bbbf2135"),
121 Value::EXCLUDE_READS);
122 // Descriptors:
107 AddOrDie(BluetoothUUID("2902"), Value::EXCLUDE_WRITES); 123 AddOrDie(BluetoothUUID("2902"), Value::EXCLUDE_WRITES);
108 AddOrDie(BluetoothUUID("2903"), Value::EXCLUDE_WRITES); 124 AddOrDie(BluetoothUUID("2903"), Value::EXCLUDE_WRITES);
125 // Descriptors for Layout Tests:
126 AddOrDie(BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c"),
127 Value::EXCLUDE);
128 AddOrDie(BluetoothUUID("bad3ec61-3cc3-4954-9702-7977df514114"),
129 Value::EXCLUDE_READS);
109 } 130 }
110 131
111 } // namespace content 132 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_blacklist_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698