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

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

Issue 2554253002: bluetooth: web: Rename Blacklist to Blocklist (Closed)
Patch Set: Created 4 years 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_device_chooser_controller.h" 5 #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <unordered_set> 9 #include <unordered_set>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "content/browser/bluetooth/bluetooth_blacklist.h" 16 #include "content/browser/bluetooth/bluetooth_blocklist.h"
17 #include "content/browser/bluetooth/bluetooth_metrics.h" 17 #include "content/browser/bluetooth/bluetooth_metrics.h"
18 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" 18 #include "content/browser/bluetooth/web_bluetooth_service_impl.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/content_browser_client.h" 20 #include "content/public/browser/content_browser_client.h"
21 #include "content/public/browser/render_frame_host.h" 21 #include "content/public/browser/render_frame_host.h"
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "content/public/browser/web_contents_delegate.h" 23 #include "content/public/browser/web_contents_delegate.h"
24 #include "device/bluetooth/bluetooth_adapter.h" 24 #include "device/bluetooth/bluetooth_adapter.h"
25 #include "device/bluetooth/bluetooth_common.h" 25 #include "device/bluetooth/bluetooth_common.h"
26 #include "device/bluetooth/bluetooth_discovery_session.h" 26 #include "device/bluetooth/bluetooth_discovery_session.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 261
262 // The renderer should never send empty filters. 262 // The renderer should never send empty filters.
263 if (HasEmptyOrInvalidFilter(options->filters)) { 263 if (HasEmptyOrInvalidFilter(options->filters)) {
264 web_bluetooth_service_->CrashRendererAndClosePipe( 264 web_bluetooth_service_->CrashRendererAndClosePipe(
265 bad_message::BDH_EMPTY_OR_INVALID_FILTERS); 265 bad_message::BDH_EMPTY_OR_INVALID_FILTERS);
266 return; 266 return;
267 } 267 }
268 options_ = std::move(options); 268 options_ = std::move(options);
269 LogRequestDeviceOptions(options_); 269 LogRequestDeviceOptions(options_);
270 270
271 // Check blacklist to reject invalid filters and adjust optional_services. 271 // Check blocklist to reject invalid filters and adjust optional_services.
272 if (BluetoothBlacklist::Get().IsExcluded(options_->filters)) { 272 if (BluetoothBlocklist::Get().IsExcluded(options_->filters)) {
273 RecordRequestDeviceOutcome( 273 RecordRequestDeviceOutcome(
274 UMARequestDeviceOutcome::BLACKLISTED_SERVICE_IN_FILTER); 274 UMARequestDeviceOutcome::BLOCKLISTED_SERVICE_IN_FILTER);
275 PostErrorCallback( 275 PostErrorCallback(
276 blink::mojom::WebBluetoothResult::REQUEST_DEVICE_WITH_BLACKLISTED_UUID); 276 blink::mojom::WebBluetoothResult::REQUEST_DEVICE_WITH_BLOCKLISTED_UUID);
277 return; 277 return;
278 } 278 }
279 BluetoothBlacklist::Get().RemoveExcludedUUIDs(options_.get()); 279 BluetoothBlocklist::Get().RemoveExcludedUUIDs(options_.get());
280 280
281 const url::Origin requesting_origin = 281 const url::Origin requesting_origin =
282 render_frame_host_->GetLastCommittedOrigin(); 282 render_frame_host_->GetLastCommittedOrigin();
283 const url::Origin embedding_origin = 283 const url::Origin embedding_origin =
284 web_contents_->GetMainFrame()->GetLastCommittedOrigin(); 284 web_contents_->GetMainFrame()->GetLastCommittedOrigin();
285 285
286 // TODO(crbug.com/518042): Enforce correctly-delegated permissions instead of 286 // TODO(crbug.com/518042): Enforce correctly-delegated permissions instead of
287 // matching origins. When relaxing this, take care to handle non-sandboxed 287 // matching origins. When relaxing this, take care to handle non-sandboxed
288 // unique origins. 288 // unique origins.
289 if (!embedding_origin.IsSameOriginWith(requesting_origin)) { 289 if (!embedding_origin.IsSameOriginWith(requesting_origin)) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 555
556 void BluetoothDeviceChooserController::PostErrorCallback( 556 void BluetoothDeviceChooserController::PostErrorCallback(
557 blink::mojom::WebBluetoothResult error) { 557 blink::mojom::WebBluetoothResult error) {
558 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( 558 if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
559 FROM_HERE, base::Bind(error_callback_, error))) { 559 FROM_HERE, base::Bind(error_callback_, error))) {
560 LOG(WARNING) << "No TaskRunner."; 560 LOG(WARNING) << "No TaskRunner.";
561 } 561 }
562 } 562 }
563 563
564 } // namespace content 564 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_device_chooser_controller.h ('k') | content/browser/bluetooth/bluetooth_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698