| OLD | NEW |
| 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 "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "content/common/bluetooth/bluetooth_scan_filter.h" | 10 #include "content/common/bluetooth/bluetooth_scan_filter.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 PopulateWithDefaultValues(); | 129 PopulateWithDefaultValues(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 BluetoothBlacklist::BluetoothBlacklist() { | 132 BluetoothBlacklist::BluetoothBlacklist() { |
| 133 PopulateWithDefaultValues(); | 133 PopulateWithDefaultValues(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void BluetoothBlacklist::PopulateWithDefaultValues() { | 136 void BluetoothBlacklist::PopulateWithDefaultValues() { |
| 137 blacklisted_uuids_.clear(); | 137 blacklisted_uuids_.clear(); |
| 138 | 138 |
| 139 // Blacklist UUIDs updated 2016-02-12 from: | |
| 140 // https://github.com/WebBluetoothCG/registries/blob/master/gatt_blacklist.txt | |
| 141 // Short UUIDs are used for readability of this list. | |
| 142 // | |
| 143 // Testing from Layout Tests Note: | 139 // Testing from Layout Tests Note: |
| 144 // | 140 // |
| 145 // Random UUIDs for object & exclude permutations that do not exist in the | 141 // Random UUIDs for object & exclude permutations that do not exist in the |
| 146 // standard blacklist are included to facilitate integration testing from | 142 // standard blacklist are included to facilitate integration testing from |
| 147 // Layout Tests. Unit tests can dynamically modify the blacklist, but don't | 143 // Layout Tests. Unit tests can dynamically modify the blacklist, but don't |
| 148 // offer the full integration test to the Web Bluetooth Javascript bindings. | 144 // offer the full integration test to the Web Bluetooth Javascript bindings. |
| 149 // | 145 // |
| 150 // This is done for simplicity as opposed to exposing a testing API that can | 146 // This is done for simplicity as opposed to exposing a testing API that can |
| 151 // add to the blacklist over time, which would be over engineered. | 147 // add to the blacklist over time, which would be over engineered. |
| 152 // | 148 // |
| 153 // Remove testing UUIDs if the specified blacklist is updated to include UUIDs | 149 // Remove testing UUIDs if the specified blacklist is updated to include UUIDs |
| 154 // that match the specific permutations. | 150 // that match the specific permutations. |
| 155 DCHECK(BluetoothUUID("00001800-0000-1000-8000-00805f9b34fb") == | 151 DCHECK(BluetoothUUID("00001800-0000-1000-8000-00805f9b34fb") == |
| 156 BluetoothUUID("1800")); | 152 BluetoothUUID("1800")); |
| 153 |
| 154 // Blacklist UUIDs updated 2016-04-07 from: |
| 155 // https://github.com/WebBluetoothCG/registries/blob/master/gatt_blacklist.txt |
| 156 // Short UUIDs are used for readability of this list. |
| 157 // |
| 157 // Services: | 158 // Services: |
| 158 Add(BluetoothUUID("1812"), Value::EXCLUDE); | 159 Add(BluetoothUUID("1812"), Value::EXCLUDE); |
| 160 Add(BluetoothUUID("00001530-1212-efde-1523-785feabcd123"), Value::EXCLUDE); |
| 161 Add(BluetoothUUID("f000ffc0-0451-4000-b000-000000000000"), Value::EXCLUDE); |
| 159 // Characteristics: | 162 // Characteristics: |
| 160 Add(BluetoothUUID("2a02"), Value::EXCLUDE_WRITES); | 163 Add(BluetoothUUID("2a02"), Value::EXCLUDE_WRITES); |
| 161 Add(BluetoothUUID("2a03"), Value::EXCLUDE); | 164 Add(BluetoothUUID("2a03"), Value::EXCLUDE); |
| 162 Add(BluetoothUUID("2a25"), Value::EXCLUDE); | 165 Add(BluetoothUUID("2a25"), Value::EXCLUDE); |
| 163 // Characteristics for Layout Tests: | 166 // Characteristics for Layout Tests: |
| 164 Add(BluetoothUUID("bad1c9a2-9a5b-4015-8b60-1579bbbf2135"), | 167 Add(BluetoothUUID("bad1c9a2-9a5b-4015-8b60-1579bbbf2135"), |
| 165 Value::EXCLUDE_READS); | 168 Value::EXCLUDE_READS); |
| 166 // Descriptors: | 169 // Descriptors: |
| 167 Add(BluetoothUUID("2902"), Value::EXCLUDE_WRITES); | 170 Add(BluetoothUUID("2902"), Value::EXCLUDE_WRITES); |
| 168 Add(BluetoothUUID("2903"), Value::EXCLUDE_WRITES); | 171 Add(BluetoothUUID("2903"), Value::EXCLUDE_WRITES); |
| 169 // Descriptors for Layout Tests: | 172 // Descriptors for Layout Tests: |
| 170 Add(BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c"), Value::EXCLUDE); | 173 Add(BluetoothUUID("bad2ddcf-60db-45cd-bef9-fd72b153cf7c"), Value::EXCLUDE); |
| 171 Add(BluetoothUUID("bad3ec61-3cc3-4954-9702-7977df514114"), | 174 Add(BluetoothUUID("bad3ec61-3cc3-4954-9702-7977df514114"), |
| 172 Value::EXCLUDE_READS); | 175 Value::EXCLUDE_READS); |
| 173 } | 176 } |
| 174 | 177 |
| 175 } // namespace content | 178 } // namespace content |
| OLD | NEW |