| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 return; | 333 return; |
| 334 } | 334 } |
| 335 | 335 |
| 336 StartDeviceDiscovery(); | 336 StartDeviceDiscovery(); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void BluetoothDeviceChooserController::AddFilteredDevice( | 339 void BluetoothDeviceChooserController::AddFilteredDevice( |
| 340 const device::BluetoothDevice& device) { | 340 const device::BluetoothDevice& device) { |
| 341 if (chooser_.get() && MatchesFilters(device, options_->filters)) { | 341 if (chooser_.get() && MatchesFilters(device, options_->filters)) { |
| 342 VLOG(1) << "Adding device to chooser: " << device.GetAddress(); | 342 VLOG(1) << "Adding device to chooser: " << device.GetAddress(); |
| 343 chooser_->AddDevice(device.GetAddress(), device.GetNameForDisplay()); | 343 chooser_->AddOrUpdateDevice(device.GetAddress(), |
| 344 device.GetNameForDisplay()); |
| 344 } | 345 } |
| 345 } | 346 } |
| 346 | 347 |
| 347 void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { | 348 void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { |
| 348 if (!powered && discovery_session_.get()) { | 349 if (!powered && discovery_session_.get()) { |
| 349 StopDiscoverySession(std::move(discovery_session_)); | 350 StopDiscoverySession(std::move(discovery_session_)); |
| 350 } | 351 } |
| 351 | 352 |
| 352 if (chooser_.get()) { | 353 if (chooser_.get()) { |
| 353 chooser_->SetAdapterPresence( | 354 chooser_->SetAdapterPresence( |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 | 482 |
| 482 void BluetoothDeviceChooserController::PostErrorCallback( | 483 void BluetoothDeviceChooserController::PostErrorCallback( |
| 483 blink::mojom::WebBluetoothError error) { | 484 blink::mojom::WebBluetoothError error) { |
| 484 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 485 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 485 FROM_HERE, base::Bind(error_callback_, error))) { | 486 FROM_HERE, base::Bind(error_callback_, error))) { |
| 486 LOG(WARNING) << "No TaskRunner."; | 487 LOG(WARNING) << "No TaskRunner."; |
| 487 } | 488 } |
| 488 } | 489 } |
| 489 | 490 |
| 490 } // namespace content | 491 } // namespace content |
| OLD | NEW |