| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 base::Unretained(this)); | 305 base::Unretained(this)); |
| 306 | 306 |
| 307 if (WebContentsDelegate* delegate = web_contents_->GetDelegate()) { | 307 if (WebContentsDelegate* delegate = web_contents_->GetDelegate()) { |
| 308 chooser_ = delegate->RunBluetoothChooser(render_frame_host_, | 308 chooser_ = delegate->RunBluetoothChooser(render_frame_host_, |
| 309 chooser_event_handler); | 309 chooser_event_handler); |
| 310 } | 310 } |
| 311 | 311 |
| 312 if (!chooser_.get()) { | 312 if (!chooser_.get()) { |
| 313 PostErrorCallback( | 313 PostErrorCallback( |
| 314 blink::mojom::WebBluetoothError::WEB_BLUETOOTH_NOT_SUPPORTED); | 314 blink::mojom::WebBluetoothError::WEB_BLUETOOTH_NOT_SUPPORTED); |
| 315 return; |
| 315 } | 316 } |
| 316 | 317 |
| 317 if (!chooser_->CanAskForScanningPermission()) { | 318 if (!chooser_->CanAskForScanningPermission()) { |
| 318 VLOG(1) << "Closing immediately because Chooser cannot obtain permission."; | 319 VLOG(1) << "Closing immediately because Chooser cannot obtain permission."; |
| 319 OnBluetoothChooserEvent(BluetoothChooser::Event::DENIED_PERMISSION, | 320 OnBluetoothChooserEvent(BluetoothChooser::Event::DENIED_PERMISSION, |
| 320 "" /* device_address */); | 321 "" /* device_address */); |
| 321 return; | 322 return; |
| 322 } | 323 } |
| 323 | 324 |
| 324 PopulateConnectedDevices(); | 325 PopulateConnectedDevices(); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 488 |
| 488 void BluetoothDeviceChooserController::PostErrorCallback( | 489 void BluetoothDeviceChooserController::PostErrorCallback( |
| 489 blink::mojom::WebBluetoothError error) { | 490 blink::mojom::WebBluetoothError error) { |
| 490 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 491 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 491 FROM_HERE, base::Bind(error_callback_, error))) { | 492 FROM_HERE, base::Bind(error_callback_, error))) { |
| 492 LOG(WARNING) << "No TaskRunner."; | 493 LOG(WARNING) << "No TaskRunner."; |
| 493 } | 494 } |
| 494 } | 495 } |
| 495 | 496 |
| 496 } // namespace content | 497 } // namespace content |
| OLD | NEW |