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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 BluetoothChooser::AdapterPresence::POWERED_OFF); | 332 BluetoothChooser::AdapterPresence::POWERED_OFF); |
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 base::Optional<int8_t> rssi = device.GetInquiryRSSI(); | |
342 chooser_->AddOrUpdateDevice( | 343 chooser_->AddOrUpdateDevice( |
343 device.GetAddress(), | 344 device.GetAddress(), |
344 // TODO(https://crbug.com/634366): Update device's name when necessary. | 345 // TODO(https://crbug.com/634366): Update device's name when necessary. |
345 false /* should_update_name */, device.GetNameForDisplay(), | 346 false /* should_update_name */, device.GetNameForDisplay(), |
346 // TODO(http://crbug.com/543466): Show connection and paired status. | 347 // TODO(http://crbug.com/543466): Show connection and paired status. |
347 false /* is_gatt_connected */, false /* is_paired */, | 348 false /* is_gatt_connected */, false /* is_paired */, |
348 // TODO(http://crbug.com/629689): Add signal strength indicator. | 349 rssi ? &(rssi.value()) : nullptr); |
msw
2016/08/12 23:08:49
Just pass a plain int8_t, instead of a const point
juncai
2016/08/15 21:53:20
Some context:
We discussed this at:
https://codere
| |
349 nullptr /* rssi */); | |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { | 353 void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { |
354 if (!powered && discovery_session_.get()) { | 354 if (!powered && discovery_session_.get()) { |
355 StopDiscoverySession(std::move(discovery_session_)); | 355 StopDiscoverySession(std::move(discovery_session_)); |
356 } | 356 } |
357 | 357 |
358 if (chooser_.get()) { | 358 if (chooser_.get()) { |
359 chooser_->SetAdapterPresence( | 359 chooser_->SetAdapterPresence( |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
487 | 487 |
488 void BluetoothDeviceChooserController::PostErrorCallback( | 488 void BluetoothDeviceChooserController::PostErrorCallback( |
489 blink::mojom::WebBluetoothError error) { | 489 blink::mojom::WebBluetoothError error) { |
490 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 490 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
491 FROM_HERE, base::Bind(error_callback_, error))) { | 491 FROM_HERE, base::Bind(error_callback_, error))) { |
492 LOG(WARNING) << "No TaskRunner."; | 492 LOG(WARNING) << "No TaskRunner."; |
493 } | 493 } |
494 } | 494 } |
495 | 495 |
496 } // namespace content | 496 } // namespace content |
OLD | NEW |