Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: content/browser/bluetooth/bluetooth_device_chooser_controller.cc

Issue 2339253002: bluetooth: mac: add connected LE devices to chooser (Closed)
Patch Set: Cleanup Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 double input_range = kMaxRSSI - kMinRSSI; 393 double input_range = kMaxRSSI - kMinRSSI;
394 double output_range = kNumSignalStrengthLevels - 1; 394 double output_range = kNumSignalStrengthLevels - 1;
395 return static_cast<int>((rssi - kMinRSSI) * output_range / input_range); 395 return static_cast<int>((rssi - kMinRSSI) * output_range / input_range);
396 } 396 }
397 397
398 void BluetoothDeviceChooserController::SetTestScanDurationForTesting() { 398 void BluetoothDeviceChooserController::SetTestScanDurationForTesting() {
399 BluetoothDeviceChooserController::use_test_scan_duration_ = true; 399 BluetoothDeviceChooserController::use_test_scan_duration_ = true;
400 } 400 }
401 401
402 void BluetoothDeviceChooserController::PopulateConnectedDevices() { 402 void BluetoothDeviceChooserController::PopulateConnectedDevices() {
403 adapter_->RetrievedConnectedPeripherals();
403 for (const device::BluetoothDevice* device : adapter_->GetDevices()) { 404 for (const device::BluetoothDevice* device : adapter_->GetDevices()) {
404 if (device->IsGattConnected()) { 405 if (device->IsGattConnected()) {
405 AddFilteredDevice(*device); 406 AddFilteredDevice(*device);
406 } 407 }
407 } 408 }
408 } 409 }
409 410
410 void BluetoothDeviceChooserController::StartDeviceDiscovery() { 411 void BluetoothDeviceChooserController::StartDeviceDiscovery() {
411 DCHECK_CURRENTLY_ON(BrowserThread::UI); 412 DCHECK_CURRENTLY_ON(BrowserThread::UI);
412 413
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 513
513 void BluetoothDeviceChooserController::PostErrorCallback( 514 void BluetoothDeviceChooserController::PostErrorCallback(
514 blink::mojom::WebBluetoothError error) { 515 blink::mojom::WebBluetoothError error) {
515 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( 516 if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
516 FROM_HERE, base::Bind(error_callback_, error))) { 517 FROM_HERE, base::Bind(error_callback_, error))) {
517 LOG(WARNING) << "No TaskRunner."; 518 LOG(WARNING) << "No TaskRunner.";
518 } 519 }
519 } 520 }
520 521
521 } // namespace content 522 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter.h » ('j') | device/bluetooth/bluetooth_adapter_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698