Chromium Code Reviews| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 } | 329 } |
| 330 | 330 |
| 331 if (!chooser_->CanAskForScanningPermission()) { | 331 if (!chooser_->CanAskForScanningPermission()) { |
| 332 VLOG(1) << "Closing immediately because Chooser cannot obtain permission."; | 332 VLOG(1) << "Closing immediately because Chooser cannot obtain permission."; |
| 333 OnBluetoothChooserEvent(BluetoothChooser::Event::DENIED_PERMISSION, | 333 OnBluetoothChooserEvent(BluetoothChooser::Event::DENIED_PERMISSION, |
| 334 "" /* device_address */); | 334 "" /* device_address */); |
| 335 return; | 335 return; |
| 336 } | 336 } |
| 337 | 337 |
| 338 PopulateConnectedDevices(); | 338 PopulateConnectedDevices(); |
| 339 std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter = | |
|
ortuno
2016/10/31 04:30:51
Let's not change web bluetooth yet. A change in we
jlebel
2016/11/07 01:43:17
Are you suggesting to add this code in a next patc
| |
| 340 ComputeScanFilter(options_->filters); | |
| 341 for (const std::pair<device::BluetoothDevice*, | |
| 342 device::BluetoothDevice::UUIDSet>& pair : | |
| 343 adapter_->RetrieveGattConnectedDevicesWithDiscoveryFilter( | |
| 344 discovery_filter.get())) { | |
| 345 AddFilteredDevice(*pair.first); | |
| 346 } | |
| 339 if (!chooser_.get()) { | 347 if (!chooser_.get()) { |
| 340 // If the dialog's closing, no need to do any of the rest of this. | 348 // If the dialog's closing, no need to do any of the rest of this. |
| 341 return; | 349 return; |
| 342 } | 350 } |
| 343 | 351 |
| 344 if (!adapter_->IsPowered()) { | 352 if (!adapter_->IsPowered()) { |
| 345 chooser_->SetAdapterPresence( | 353 chooser_->SetAdapterPresence( |
| 346 BluetoothChooser::AdapterPresence::POWERED_OFF); | 354 BluetoothChooser::AdapterPresence::POWERED_OFF); |
| 347 return; | 355 return; |
| 348 } | 356 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 | 520 |
| 513 void BluetoothDeviceChooserController::PostErrorCallback( | 521 void BluetoothDeviceChooserController::PostErrorCallback( |
| 514 blink::mojom::WebBluetoothResult error) { | 522 blink::mojom::WebBluetoothResult error) { |
| 515 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 523 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 516 FROM_HERE, base::Bind(error_callback_, error))) { | 524 FROM_HERE, base::Bind(error_callback_, error))) { |
| 517 LOG(WARNING) << "No TaskRunner."; | 525 LOG(WARNING) << "No TaskRunner."; |
| 518 } | 526 } |
| 519 } | 527 } |
| 520 | 528 |
| 521 } // namespace content | 529 } // namespace content |
| OLD | NEW |