| 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/bluetooth_device_bluez.h" | 5 #include "device/bluetooth/bluetooth_device_bluez.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 14 #include "dbus/bus.h" | 15 #include "dbus/bus.h" |
| 15 #include "device/bluetooth/bluetooth_adapter_bluez.h" | 16 #include "device/bluetooth/bluetooth_adapter_bluez.h" |
| 16 #include "device/bluetooth/bluetooth_gatt_connection_bluez.h" | 17 #include "device/bluetooth/bluetooth_gatt_connection_bluez.h" |
| 17 #include "device/bluetooth/bluetooth_pairing_bluez.h" | 18 #include "device/bluetooth/bluetooth_pairing_bluez.h" |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 UMA_PAIRING_RESULT_SUCCESS, | 630 UMA_PAIRING_RESULT_SUCCESS, |
| 630 UMA_PAIRING_RESULT_COUNT); | 631 UMA_PAIRING_RESULT_COUNT); |
| 631 | 632 |
| 632 callback.Run(); | 633 callback.Run(); |
| 633 } | 634 } |
| 634 | 635 |
| 635 void BluetoothDeviceBlueZ::OnCreateGattConnection( | 636 void BluetoothDeviceBlueZ::OnCreateGattConnection( |
| 636 const GattConnectionCallback& callback) { | 637 const GattConnectionCallback& callback) { |
| 637 scoped_ptr<device::BluetoothGattConnection> conn( | 638 scoped_ptr<device::BluetoothGattConnection> conn( |
| 638 new BluetoothGattConnectionBlueZ(adapter_, GetAddress(), object_path_)); | 639 new BluetoothGattConnectionBlueZ(adapter_, GetAddress(), object_path_)); |
| 639 callback.Run(conn.Pass()); | 640 callback.Run(std::move(conn)); |
| 640 } | 641 } |
| 641 | 642 |
| 642 void BluetoothDeviceBlueZ::OnConnectError( | 643 void BluetoothDeviceBlueZ::OnConnectError( |
| 643 bool after_pairing, | 644 bool after_pairing, |
| 644 const ConnectErrorCallback& error_callback, | 645 const ConnectErrorCallback& error_callback, |
| 645 const std::string& error_name, | 646 const std::string& error_name, |
| 646 const std::string& error_message) { | 647 const std::string& error_message) { |
| 647 if (--num_connecting_calls_ == 0) | 648 if (--num_connecting_calls_ == 0) |
| 648 adapter()->NotifyDeviceChanged(this); | 649 adapter()->NotifyDeviceChanged(this); |
| 649 | 650 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, | 765 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, |
| 765 const std::string& error_name, | 766 const std::string& error_name, |
| 766 const std::string& error_message) { | 767 const std::string& error_message) { |
| 767 LOG(WARNING) << object_path_.value() | 768 LOG(WARNING) << object_path_.value() |
| 768 << ": Failed to remove device: " << error_name << ": " | 769 << ": Failed to remove device: " << error_name << ": " |
| 769 << error_message; | 770 << error_message; |
| 770 error_callback.Run(); | 771 error_callback.Run(); |
| 771 } | 772 } |
| 772 | 773 |
| 773 } // namespace bluez | 774 } // namespace bluez |
| OLD | NEW |