| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "device/bluetooth/bluez/bluetooth_device_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_device_bluez.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 return properties->appearance.value(); | 307 return properties->appearance.value(); |
| 308 } | 308 } |
| 309 | 309 |
| 310 base::Optional<std::string> BluetoothDeviceBlueZ::GetName() const { | 310 base::Optional<std::string> BluetoothDeviceBlueZ::GetName() const { |
| 311 bluez::BluetoothDeviceClient::Properties* properties = | 311 bluez::BluetoothDeviceClient::Properties* properties = |
| 312 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( | 312 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( |
| 313 object_path_); | 313 object_path_); |
| 314 DCHECK(properties); | 314 DCHECK(properties); |
| 315 | 315 |
| 316 return properties->alias.value(); | 316 if (properties->name.is_valid()) |
| 317 return properties->name.value(); |
| 318 else |
| 319 return base::nullopt; |
| 317 } | 320 } |
| 318 | 321 |
| 319 bool BluetoothDeviceBlueZ::IsPaired() const { | 322 bool BluetoothDeviceBlueZ::IsPaired() const { |
| 320 bluez::BluetoothDeviceClient::Properties* properties = | 323 bluez::BluetoothDeviceClient::Properties* properties = |
| 321 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( | 324 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( |
| 322 object_path_); | 325 object_path_); |
| 323 DCHECK(properties); | 326 DCHECK(properties); |
| 324 | 327 |
| 325 // Trusted devices are devices that don't support pairing but that the | 328 // Trusted devices are devices that don't support pairing but that the |
| 326 // user has explicitly connected; it makes no sense for UI purposes to | 329 // user has explicitly connected; it makes no sense for UI purposes to |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, | 916 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, |
| 914 const std::string& error_name, | 917 const std::string& error_name, |
| 915 const std::string& error_message) { | 918 const std::string& error_message) { |
| 916 LOG(WARNING) << object_path_.value() | 919 LOG(WARNING) << object_path_.value() |
| 917 << ": Failed to remove device: " << error_name << ": " | 920 << ": Failed to remove device: " << error_name << ": " |
| 918 << error_message; | 921 << error_message; |
| 919 error_callback.Run(); | 922 error_callback.Run(); |
| 920 } | 923 } |
| 921 | 924 |
| 922 } // namespace bluez | 925 } // namespace bluez |
| OLD | NEW |