| 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( |
| 344 device.GetAddress(), |
| 345 // TODO(https://crbug.com/634366): Update device's name when necessary. |
| 346 false /* should_update_name */, device.GetNameForDisplay(), |
| 347 // TODO(http://crbug.com/543466): Show connection and paired status. |
| 348 false /* is_gatt_connected */, false /* is_paired */, |
| 349 // TODO(http://crbug.com/629689): Add signal strength indicator. |
| 350 nullptr /* rssi */); |
| 344 } | 351 } |
| 345 } | 352 } |
| 346 | 353 |
| 347 void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { | 354 void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { |
| 348 if (!powered && discovery_session_.get()) { | 355 if (!powered && discovery_session_.get()) { |
| 349 StopDiscoverySession(std::move(discovery_session_)); | 356 StopDiscoverySession(std::move(discovery_session_)); |
| 350 } | 357 } |
| 351 | 358 |
| 352 if (chooser_.get()) { | 359 if (chooser_.get()) { |
| 353 chooser_->SetAdapterPresence( | 360 chooser_->SetAdapterPresence( |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 | 488 |
| 482 void BluetoothDeviceChooserController::PostErrorCallback( | 489 void BluetoothDeviceChooserController::PostErrorCallback( |
| 483 blink::mojom::WebBluetoothError error) { | 490 blink::mojom::WebBluetoothError error) { |
| 484 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 491 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 485 FROM_HERE, base::Bind(error_callback_, error))) { | 492 FROM_HERE, base::Bind(error_callback_, error))) { |
| 486 LOG(WARNING) << "No TaskRunner."; | 493 LOG(WARNING) << "No TaskRunner."; |
| 487 } | 494 } |
| 488 } | 495 } |
| 489 | 496 |
| 490 } // namespace content | 497 } // namespace content |
| OLD | NEW |