Index: device/bluetooth/bluetooth_adapter_profile_chromeos.cc |
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc |
index 2feff37aed352abdbf8c54b8f42ecd096f465639..e0ceb3d886b89c4f8556315b35078836a14cef48 100644 |
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc |
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc |
@@ -18,30 +18,40 @@ |
namespace chromeos { |
+namespace { |
+ |
+void OnRegisterProfileError( |
+ scoped_ptr<BluetoothAdapterProfileChromeOS> profile, |
+ const BluetoothProfileManagerClient::ErrorCallback& error_callback, |
+ const std::string& error_name, |
+ const std::string& error_message) { |
+ error_callback.Run(error_name, error_message); |
+} |
+ |
+} // anonymous namespace |
+ |
// static |
-BluetoothAdapterProfileChromeOS* BluetoothAdapterProfileChromeOS::Register( |
- BluetoothAdapterChromeOS* adapter, |
+void BluetoothAdapterProfileChromeOS::Register( |
const device::BluetoothUUID& uuid, |
const BluetoothProfileManagerClient::Options& options, |
- const base::Closure& success_callback, |
+ const ProfileRegisteredCallback& success_callback, |
const BluetoothProfileManagerClient::ErrorCallback& error_callback) { |
- DCHECK(adapter); |
- |
- BluetoothAdapterProfileChromeOS* profile = |
- new BluetoothAdapterProfileChromeOS(adapter, uuid); |
+ scoped_ptr<BluetoothAdapterProfileChromeOS> profile( |
+ new BluetoothAdapterProfileChromeOS(uuid)); |
VLOG(1) << "Registering profile: " << profile->object_path().value(); |
DBusThreadManager::Get()->GetBluetoothProfileManagerClient()->RegisterProfile( |
- profile->object_path(), uuid.canonical_value(), options, success_callback, |
- error_callback); |
- |
- return profile; |
+ profile->object_path(), |
+ uuid.canonical_value(), |
+ options, |
+ base::Bind(success_callback, base::Passed(&profile)), |
+ base::Bind(OnRegisterProfileError, base::Passed(&profile), |
+ error_callback)); |
Ilya Sherman
2015/03/05 04:33:54
This looks to me like it will actually lead to a d
Marie Janssen
2015/03/09 16:22:49
Done.
|
} |
BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS( |
- BluetoothAdapterChromeOS* adapter, |
const device::BluetoothUUID& uuid) |
- : uuid_(uuid), adapter_(adapter), weak_ptr_factory_(this) { |
+ : uuid_(uuid), weak_ptr_factory_(this) { |
std::string uuid_path; |
base::ReplaceChars(uuid.canonical_value(), ":-", "_", &uuid_path); |
object_path_ = |
@@ -54,7 +64,6 @@ BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS( |
} |
BluetoothAdapterProfileChromeOS::~BluetoothAdapterProfileChromeOS() { |
- profile_.reset(); |
} |
bool BluetoothAdapterProfileChromeOS::SetDelegate( |