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