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_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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 case ContentBrowserClient::AllowWebBluetoothResult::ALLOW: | 383 case ContentBrowserClient::AllowWebBluetoothResult::ALLOW: |
384 break; | 384 break; |
385 } | 385 } |
386 | 386 |
387 BluetoothChooser::EventHandler chooser_event_handler = | 387 BluetoothChooser::EventHandler chooser_event_handler = |
388 base::Bind(&BluetoothDeviceChooserController::OnBluetoothChooserEvent, | 388 base::Bind(&BluetoothDeviceChooserController::OnBluetoothChooserEvent, |
389 base::Unretained(this)); | 389 base::Unretained(this)); |
390 | 390 |
391 if (WebContentsDelegate* delegate = web_contents_->GetDelegate()) { | 391 if (WebContentsDelegate* delegate = web_contents_->GetDelegate()) { |
392 chooser_ = delegate->RunBluetoothChooser(render_frame_host_, | 392 chooser_ = |
393 chooser_event_handler); | 393 delegate->RunBluetoothChooser(render_frame_host_, chooser_event_handler, |
| 394 options_->accept_all_devices); |
394 } | 395 } |
395 | 396 |
396 if (!chooser_.get()) { | 397 if (!chooser_.get()) { |
397 PostErrorCallback( | 398 PostErrorCallback( |
398 blink::mojom::WebBluetoothResult::WEB_BLUETOOTH_NOT_SUPPORTED); | 399 blink::mojom::WebBluetoothResult::WEB_BLUETOOTH_NOT_SUPPORTED); |
399 return; | 400 return; |
400 } | 401 } |
401 | 402 |
402 if (!chooser_->CanAskForScanningPermission()) { | 403 if (!chooser_->CanAskForScanningPermission()) { |
403 VLOG(1) << "Closing immediately because Chooser cannot obtain permission."; | 404 VLOG(1) << "Closing immediately because Chooser cannot obtain permission."; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 610 |
610 void BluetoothDeviceChooserController::PostErrorCallback( | 611 void BluetoothDeviceChooserController::PostErrorCallback( |
611 blink::mojom::WebBluetoothResult error) { | 612 blink::mojom::WebBluetoothResult error) { |
612 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 613 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
613 FROM_HERE, base::Bind(error_callback_, error))) { | 614 FROM_HERE, base::Bind(error_callback_, error))) { |
614 LOG(WARNING) << "No TaskRunner."; | 615 LOG(WARNING) << "No TaskRunner."; |
615 } | 616 } |
616 } | 617 } |
617 | 618 |
618 } // namespace content | 619 } // namespace content |
OLD | NEW |