| Index: device/bluetooth/bluetooth_adapter_chromeos.cc
|
| diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc
|
| index 6ba63439290b0d8ad8dbf7c6f0e83957a1f48cc2..c48202637213d1686f02513326dd8b0a57d43c3c 100644
|
| --- a/device/bluetooth/bluetooth_adapter_chromeos.cc
|
| +++ b/device/bluetooth/bluetooth_adapter_chromeos.cc
|
| @@ -359,8 +359,7 @@ void BluetoothAdapterChromeOS::UpdateDevice(
|
| devices_[address] = device;
|
| }
|
|
|
| - const bool was_paired = device->IsPaired();
|
| - if (!was_paired) {
|
| + if (!device->HasObjectPath()) {
|
| VLOG(1) << "Assigned object path " << device_path.value() << " to device "
|
| << address;
|
| device->SetObjectPath(device_path);
|
| @@ -417,7 +416,7 @@ void BluetoothAdapterChromeOS::DeviceRemoved(
|
| // DeviceRemoved can also be called to indicate a device that is visible
|
| // during discovery has disconnected, but it is still visible to the
|
| // adapter, so don't remove in that case and only clear the object path.
|
| - if (!device->IsVisible()) {
|
| + if (!device->WasDiscovered()) {
|
| FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
|
| DeviceRemoved(this, device));
|
|
|
| @@ -445,17 +444,20 @@ void BluetoothAdapterChromeOS::DevicesChanged(
|
| void BluetoothAdapterChromeOS::ClearDiscoveredDevices() {
|
| DevicesMap::iterator iter = devices_.begin();
|
| while (iter != devices_.end()) {
|
| - BluetoothDevice* device = iter->second;
|
| + BluetoothDeviceChromeOS* device =
|
| + static_cast<BluetoothDeviceChromeOS*>(iter->second);
|
| DevicesMap::iterator temp = iter;
|
| ++iter;
|
|
|
| - if (!device->IsPaired()) {
|
| + if (!device->HasObjectPath()) {
|
| FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
|
| DeviceRemoved(this, device));
|
|
|
| delete device;
|
| devices_.erase(temp);
|
| - }
|
| +
|
| + } else
|
| + device->SetDiscovered(false);
|
| }
|
| }
|
|
|
| @@ -480,7 +482,7 @@ void BluetoothAdapterChromeOS::DeviceFound(
|
| }
|
|
|
| VLOG(1) << "Device " << address << " is visible to the adapter";
|
| - device->SetVisible(true);
|
| + device->SetDiscovered(true);
|
| device->Update(&properties, false);
|
|
|
| if (update_device) {
|
| @@ -508,7 +510,7 @@ void BluetoothAdapterChromeOS::DeviceDisappeared(
|
| // DeviceDisappeared can also be called to indicate that a device we've
|
| // paired with is no longer visible to the adapter, so don't remove
|
| // in that case and only clear the visible flag.
|
| - if (!device->IsPaired()) {
|
| + if (!device->HasObjectPath()) {
|
| FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
|
| DeviceRemoved(this, device));
|
|
|
| @@ -520,7 +522,7 @@ void BluetoothAdapterChromeOS::DeviceDisappeared(
|
| } else {
|
| VLOG(1) << "Paired device " << device->address()
|
| << " is no longer visible to the adapter";
|
| - device->SetVisible(false);
|
| + device->SetDiscovered(false);
|
|
|
| FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
|
| DeviceChanged(this, device));
|
|
|