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

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

Issue 2716583003: Rename Origin.unique() to opaque().
Patch Set: Update new uses post-rebase Created 3 years, 4 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_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
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 335 }
336 BluetoothBlocklist::Get().RemoveExcludedUUIDs(options_.get()); 336 BluetoothBlocklist::Get().RemoveExcludedUUIDs(options_.get());
337 337
338 const url::Origin requesting_origin = 338 const url::Origin requesting_origin =
339 render_frame_host_->GetLastCommittedOrigin(); 339 render_frame_host_->GetLastCommittedOrigin();
340 const url::Origin embedding_origin = 340 const url::Origin embedding_origin =
341 web_contents_->GetMainFrame()->GetLastCommittedOrigin(); 341 web_contents_->GetMainFrame()->GetLastCommittedOrigin();
342 342
343 // TODO(crbug.com/518042): Enforce correctly-delegated permissions instead of 343 // TODO(crbug.com/518042): Enforce correctly-delegated permissions instead of
344 // matching origins. When relaxing this, take care to handle non-sandboxed 344 // matching origins. When relaxing this, take care to handle non-sandboxed
345 // unique origins. 345 // opaque origins.
346 if (!embedding_origin.IsSameOriginWith(requesting_origin)) { 346 if (!embedding_origin.IsSameOriginWith(requesting_origin)) {
347 PostErrorCallback(blink::mojom::WebBluetoothResult:: 347 PostErrorCallback(blink::mojom::WebBluetoothResult::
348 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME); 348 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME);
349 return; 349 return;
350 } 350 }
351 // The above also excludes unique origins, which are not even same-origin with 351 // The above also excludes opaque origins, which are not even same-origin with
352 // themselves. 352 // themselves.
353 DCHECK(!requesting_origin.unique()); 353 // TODO: This is no longer true, and will crash here if embedding_origin is
354 // the same object as requesting_origin.
355 DCHECK(!requesting_origin.opaque());
354 356
355 if (!adapter_->IsPresent()) { 357 if (!adapter_->IsPresent()) {
356 DVLOG(1) << "Bluetooth Adapter not present. Can't serve requestDevice."; 358 DVLOG(1) << "Bluetooth Adapter not present. Can't serve requestDevice.";
357 RecordRequestDeviceOutcome( 359 RecordRequestDeviceOutcome(
358 UMARequestDeviceOutcome::BLUETOOTH_ADAPTER_NOT_PRESENT); 360 UMARequestDeviceOutcome::BLUETOOTH_ADAPTER_NOT_PRESENT);
359 PostErrorCallback(blink::mojom::WebBluetoothResult::NO_BLUETOOTH_ADAPTER); 361 PostErrorCallback(blink::mojom::WebBluetoothResult::NO_BLUETOOTH_ADAPTER);
360 return; 362 return;
361 } 363 }
362 364
363 switch (GetContentClient()->browser()->AllowWebBluetooth( 365 switch (GetContentClient()->browser()->AllowWebBluetooth(
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 620
619 void BluetoothDeviceChooserController::PostErrorCallback( 621 void BluetoothDeviceChooserController::PostErrorCallback(
620 blink::mojom::WebBluetoothResult error) { 622 blink::mojom::WebBluetoothResult error) {
621 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( 623 if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
622 FROM_HERE, base::Bind(error_callback_, error))) { 624 FROM_HERE, base::Bind(error_callback_, error))) {
623 LOG(WARNING) << "No TaskRunner."; 625 LOG(WARNING) << "No TaskRunner.";
624 } 626 }
625 } 627 }
626 628
627 } // namespace content 629 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698