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

Unified Diff: content/browser/bluetooth/bluetooth_device_chooser_controller.cc

Issue 2304213002: Show device connection and paired status in chooser on Mac (Closed)
Patch Set: added code to handle text identation Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/bluetooth_device_chooser_controller.cc
diff --git a/content/browser/bluetooth/bluetooth_device_chooser_controller.cc b/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
index d524f19a864af9ab0535804a44eb4ad78e27bf78..cbf6c1e3d8a256cfaee2a2596226ce0652a6a845 100644
--- a/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
+++ b/content/browser/bluetooth/bluetooth_device_chooser_controller.cc
@@ -198,7 +198,9 @@ UMARequestDeviceOutcome OutcomeFromChooserEvent(BluetoothChooser::Event event) {
BluetoothDeviceChooserController::BluetoothDeviceChooserController(
WebBluetoothServiceImpl* web_bluetooth_service,
RenderFrameHost* render_frame_host,
- device::BluetoothAdapter* adapter)
+ device::BluetoothAdapter* adapter,
+ const BluetoothAllowedDevicesMap& bluetooth_allowed_devices_map,
+ const url::Origin& origin)
: adapter_(adapter),
web_bluetooth_service_(web_bluetooth_service),
render_frame_host_(render_frame_host),
@@ -214,6 +216,8 @@ BluetoothDeviceChooserController::BluetoothDeviceChooserController(
// destructor starts.
base::Unretained(this)),
/*is_repeating=*/false),
+ bluetooth_allowed_devices_map_(bluetooth_allowed_devices_map),
+ origin_(origin),
weak_ptr_factory_(this) {
CHECK(adapter_);
}
@@ -350,11 +354,11 @@ void BluetoothDeviceChooserController::AddFilteredDevice(
const device::BluetoothDevice& device) {
if (chooser_.get() && MatchesFilters(device, options_->filters)) {
base::Optional<int8_t> rssi = device.GetInquiryRSSI();
+ bool is_paired = bluetooth_allowed_devices_map_.GetDeviceId(
+ origin_, device.GetAddress()) != nullptr;
chooser_->AddOrUpdateDevice(
device.GetAddress(), !!device.GetName() /* should_update_name */,
- device.GetNameForDisplay(),
- // TODO(http://crbug.com/543466): Show connection and paired status.
- false /* is_gatt_connected */, false /* is_paired */,
+ device.GetNameForDisplay(), device.IsGattConnected(), is_paired,
rssi ? CalculateSignalStrengthLevel(rssi.value()) : -1);
}
}

Powered by Google App Engine
This is Rietveld 408576698