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

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

Issue 2789243002: Rename BluetoothScanFilterInit to BluetoothLEScanFilterInit (Closed)
Patch Set: Codereview: nit Created 3 years, 8 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 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_blocklist.h" 5 #include "content/browser/bluetooth/bluetooth_blocklist.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/optional.h" 9 #include "base/optional.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 bool BluetoothBlocklist::IsExcluded(const BluetoothUUID& uuid) const { 80 bool BluetoothBlocklist::IsExcluded(const BluetoothUUID& uuid) const {
81 CHECK(uuid.IsValid()); 81 CHECK(uuid.IsValid());
82 const auto& it = blocklisted_uuids_.find(uuid); 82 const auto& it = blocklisted_uuids_.find(uuid);
83 if (it == blocklisted_uuids_.end()) 83 if (it == blocklisted_uuids_.end())
84 return false; 84 return false;
85 return it->second == Value::EXCLUDE; 85 return it->second == Value::EXCLUDE;
86 } 86 }
87 87
88 bool BluetoothBlocklist::IsExcluded( 88 bool BluetoothBlocklist::IsExcluded(
89 const std::vector<blink::mojom::WebBluetoothScanFilterPtr>& filters) { 89 const std::vector<blink::mojom::WebBluetoothLeScanFilterPtr>& filters) {
90 for (const blink::mojom::WebBluetoothScanFilterPtr& filter : filters) { 90 for (const blink::mojom::WebBluetoothLeScanFilterPtr& filter : filters) {
91 if (!filter->services) { 91 if (!filter->services) {
92 continue; 92 continue;
93 } 93 }
94 for (const BluetoothUUID& service : filter->services.value()) { 94 for (const BluetoothUUID& service : filter->services.value()) {
95 if (IsExcluded(service)) { 95 if (IsExcluded(service)) {
96 return true; 96 return true;
97 } 97 }
98 } 98 }
99 } 99 }
100 return false; 100 return false;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 Value::EXCLUDE_READS); 182 Value::EXCLUDE_READS);
183 } 183 }
184 184
185 void BluetoothBlocklist::PopulateWithServerProvidedValues() { 185 void BluetoothBlocklist::PopulateWithServerProvidedValues() {
186 // DCHECK to maybe help debug https://crbug.com/604078. 186 // DCHECK to maybe help debug https://crbug.com/604078.
187 DCHECK(GetContentClient()); 187 DCHECK(GetContentClient());
188 Add(GetContentClient()->browser()->GetWebBluetoothBlocklist()); 188 Add(GetContentClient()->browser()->GetWebBluetoothBlocklist());
189 } 189 }
190 190
191 } // namespace content 191 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_blocklist.h ('k') | content/browser/bluetooth/bluetooth_blocklist_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698