Commit ec412f3c authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[base] Apply BindOnceRewriter in //device/bluetooth/bluez

This change applies the BindOnceRewriter in //device/bluetooth/bluez.
This rewriter replaces calls to base::Bind and base::BindRepeating with
calls to base::BindOnce, in case the result is immediately assigned to a
base::OnceCallback. Given that base::RepeatingCallback is implicitly
convertible to base::OnceCallback, there is no change in functionality.

Steps:
  1. run_tool.py --tool base_bind_rewriters \
                 --tool-arg='--rewriter=bind_to_bind_once'
  2. git cl format

This CL was uploaded by git cl split.

R=sonnysasaka@chromium.org

Bug: 714018
Change-Id: I294a17baa39c390c53928676b4c3cefd09f67e37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132135
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarSonny Sasaka <sonnysasaka@chromium.org>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755456}
parent f93fd523
...@@ -352,9 +352,9 @@ void BluetoothAdapterBlueZ::SetName(const std::string& name, ...@@ -352,9 +352,9 @@ void BluetoothAdapterBlueZ::SetName(const std::string& name,
->GetBluetoothAdapterClient() ->GetBluetoothAdapterClient()
->GetProperties(object_path_) ->GetProperties(object_path_)
->alias.Set( ->alias.Set(
name, name, base::BindOnce(
base::Bind(&BluetoothAdapterBlueZ::OnPropertyChangeCompleted, &BluetoothAdapterBlueZ::OnPropertyChangeCompleted,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
} }
bool BluetoothAdapterBlueZ::IsInitialized() const { bool BluetoothAdapterBlueZ::IsInitialized() const {
...@@ -393,8 +393,9 @@ void BluetoothAdapterBlueZ::SetPowered(bool powered, ...@@ -393,8 +393,9 @@ void BluetoothAdapterBlueZ::SetPowered(bool powered,
->GetProperties(object_path_) ->GetProperties(object_path_)
->powered.Set( ->powered.Set(
powered, powered,
base::Bind(&BluetoothAdapterBlueZ::OnPropertyChangeCompleted, base::BindOnce(&BluetoothAdapterBlueZ::OnPropertyChangeCompleted,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); weak_ptr_factory_.GetWeakPtr(), callback,
error_callback));
} }
bool BluetoothAdapterBlueZ::IsDiscoverable() const { bool BluetoothAdapterBlueZ::IsDiscoverable() const {
...@@ -425,8 +426,9 @@ void BluetoothAdapterBlueZ::SetDiscoverable( ...@@ -425,8 +426,9 @@ void BluetoothAdapterBlueZ::SetDiscoverable(
->GetProperties(object_path_) ->GetProperties(object_path_)
->discoverable.Set( ->discoverable.Set(
discoverable, discoverable,
base::Bind(&BluetoothAdapterBlueZ::OnSetDiscoverable, base::BindOnce(&BluetoothAdapterBlueZ::OnSetDiscoverable,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); weak_ptr_factory_.GetWeakPtr(), callback,
error_callback));
} }
uint32_t BluetoothAdapterBlueZ::GetDiscoverableTimeout() const { uint32_t BluetoothAdapterBlueZ::GetDiscoverableTimeout() const {
...@@ -559,7 +561,7 @@ void BluetoothAdapterBlueZ::SetAdvertisingInterval( ...@@ -559,7 +561,7 @@ void BluetoothAdapterBlueZ::SetAdvertisingInterval(
->GetBluetoothLEAdvertisingManagerClient() ->GetBluetoothLEAdvertisingManagerClient()
->SetAdvertisingInterval( ->SetAdvertisingInterval(
object_path_, min_ms, max_ms, callback, object_path_, min_ms, max_ms, callback,
base::Bind(&SetIntervalErrorCallbackConnector, error_callback)); base::BindOnce(&SetIntervalErrorCallbackConnector, error_callback));
} }
void BluetoothAdapterBlueZ::ResetAdvertising( void BluetoothAdapterBlueZ::ResetAdvertising(
...@@ -568,9 +570,9 @@ void BluetoothAdapterBlueZ::ResetAdvertising( ...@@ -568,9 +570,9 @@ void BluetoothAdapterBlueZ::ResetAdvertising(
DCHECK(bluez::BluezDBusManager::Get()); DCHECK(bluez::BluezDBusManager::Get());
bluez::BluezDBusManager::Get() bluez::BluezDBusManager::Get()
->GetBluetoothLEAdvertisingManagerClient() ->GetBluetoothLEAdvertisingManagerClient()
->ResetAdvertising( ->ResetAdvertising(object_path_, callback,
object_path_, callback, base::BindOnce(&ResetAdvertisingErrorCallbackConnector,
base::Bind(&ResetAdvertisingErrorCallbackConnector, error_callback)); error_callback));
} }
device::BluetoothLocalGattService* BluetoothAdapterBlueZ::GetGattService( device::BluetoothLocalGattService* BluetoothAdapterBlueZ::GetGattService(
...@@ -985,8 +987,8 @@ void BluetoothAdapterBlueZ::CreateServiceRecord( ...@@ -985,8 +987,8 @@ void BluetoothAdapterBlueZ::CreateServiceRecord(
->GetBluetoothAdapterClient() ->GetBluetoothAdapterClient()
->CreateServiceRecord( ->CreateServiceRecord(
object_path_, record, callback, object_path_, record, callback,
base::Bind(&BluetoothAdapterBlueZ::ServiceRecordErrorConnector, base::BindOnce(&BluetoothAdapterBlueZ::ServiceRecordErrorConnector,
weak_ptr_factory_.GetWeakPtr(), error_callback)); weak_ptr_factory_.GetWeakPtr(), error_callback));
} }
void BluetoothAdapterBlueZ::RemoveServiceRecord( void BluetoothAdapterBlueZ::RemoveServiceRecord(
...@@ -997,8 +999,8 @@ void BluetoothAdapterBlueZ::RemoveServiceRecord( ...@@ -997,8 +999,8 @@ void BluetoothAdapterBlueZ::RemoveServiceRecord(
->GetBluetoothAdapterClient() ->GetBluetoothAdapterClient()
->RemoveServiceRecord( ->RemoveServiceRecord(
object_path_, handle, callback, object_path_, handle, callback,
base::Bind(&BluetoothAdapterBlueZ::ServiceRecordErrorConnector, base::BindOnce(&BluetoothAdapterBlueZ::ServiceRecordErrorConnector,
weak_ptr_factory_.GetWeakPtr(), error_callback)); weak_ptr_factory_.GetWeakPtr(), error_callback));
} }
BluetoothDeviceBlueZ* BluetoothAdapterBlueZ::GetDeviceWithPath( BluetoothDeviceBlueZ* BluetoothAdapterBlueZ::GetDeviceWithPath(
...@@ -1481,9 +1483,9 @@ void BluetoothAdapterBlueZ::OnSetDiscoverable( ...@@ -1481,9 +1483,9 @@ void BluetoothAdapterBlueZ::OnSetDiscoverable(
->GetBluetoothAdapterClient() ->GetBluetoothAdapterClient()
->GetProperties(object_path_) ->GetProperties(object_path_)
->discoverable_timeout.Set( ->discoverable_timeout.Set(
0, 0, base::BindOnce(&BluetoothAdapterBlueZ::OnPropertyChangeCompleted,
base::Bind(&BluetoothAdapterBlueZ::OnPropertyChangeCompleted, weak_ptr_factory_.GetWeakPtr(), callback,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); error_callback));
} }
void BluetoothAdapterBlueZ::OnPropertyChangeCompleted( void BluetoothAdapterBlueZ::OnPropertyChangeCompleted(
...@@ -1569,7 +1571,7 @@ void BluetoothAdapterBlueZ::StartScanWithFilter( ...@@ -1569,7 +1571,7 @@ void BluetoothAdapterBlueZ::StartScanWithFilter(
// This is the first request to start device discovery. // This is the first request to start device discovery.
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery( bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
object_path_, object_path_,
base::BindRepeating( base::BindOnce(
&BluetoothAdapterBlueZ::OnStartDiscovery, &BluetoothAdapterBlueZ::OnStartDiscovery,
weak_ptr_factory_.GetWeakPtr(), weak_ptr_factory_.GetWeakPtr(),
base::BindRepeating(copyable_callback, /*is_error=*/false, base::BindRepeating(copyable_callback, /*is_error=*/false,
...@@ -1605,7 +1607,7 @@ void BluetoothAdapterBlueZ::StopScan(DiscoverySessionResultCallback callback) { ...@@ -1605,7 +1607,7 @@ void BluetoothAdapterBlueZ::StopScan(DiscoverySessionResultCallback callback) {
auto copyable_callback = base::AdaptCallbackForRepeating(std::move(callback)); auto copyable_callback = base::AdaptCallbackForRepeating(std::move(callback));
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StopDiscovery( bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StopDiscovery(
object_path_, object_path_,
base::BindRepeating( base::BindOnce(
&BluetoothAdapterBlueZ::OnStopDiscovery, &BluetoothAdapterBlueZ::OnStopDiscovery,
weak_ptr_factory_.GetWeakPtr(), weak_ptr_factory_.GetWeakPtr(),
base::BindRepeating(copyable_callback, /*is_error=*/false, base::BindRepeating(copyable_callback, /*is_error=*/false,
...@@ -1664,9 +1666,9 @@ void BluetoothAdapterBlueZ::SetDiscoveryFilter( ...@@ -1664,9 +1666,9 @@ void BluetoothAdapterBlueZ::SetDiscoveryFilter(
->GetBluetoothAdapterClient() ->GetBluetoothAdapterClient()
->SetDiscoveryFilter( ->SetDiscoveryFilter(
object_path_, dbus_discovery_filter, object_path_, dbus_discovery_filter,
base::BindRepeating(&BluetoothAdapterBlueZ::OnSetDiscoveryFilter, base::BindOnce(&BluetoothAdapterBlueZ::OnSetDiscoveryFilter,
weak_ptr_factory_.GetWeakPtr(), callback, weak_ptr_factory_.GetWeakPtr(), callback,
copyable_error_callback), copyable_error_callback),
base::BindOnce(&BluetoothAdapterBlueZ::OnSetDiscoveryFilterError, base::BindOnce(&BluetoothAdapterBlueZ::OnSetDiscoveryFilterError,
weak_ptr_factory_.GetWeakPtr(), callback, weak_ptr_factory_.GetWeakPtr(), callback,
copyable_error_callback)); copyable_error_callback));
...@@ -1744,9 +1746,9 @@ void BluetoothAdapterBlueZ::OnPreSetDiscoveryFilter( ...@@ -1744,9 +1746,9 @@ void BluetoothAdapterBlueZ::OnPreSetDiscoveryFilter(
base::AdaptCallbackForRepeating(std::move(error_callback)); base::AdaptCallbackForRepeating(std::move(error_callback));
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery( bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
object_path_, object_path_,
base::BindRepeating(&BluetoothAdapterBlueZ::OnStartDiscovery, base::BindOnce(&BluetoothAdapterBlueZ::OnStartDiscovery,
weak_ptr_factory_.GetWeakPtr(), callback, weak_ptr_factory_.GetWeakPtr(), callback,
copyable_error_callback), copyable_error_callback),
base::BindOnce(&BluetoothAdapterBlueZ::OnStartDiscoveryError, base::BindOnce(&BluetoothAdapterBlueZ::OnStartDiscoveryError,
weak_ptr_factory_.GetWeakPtr(), callback, weak_ptr_factory_.GetWeakPtr(), callback,
copyable_error_callback)); copyable_error_callback));
......
...@@ -225,10 +225,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, BlackHole) { ...@@ -225,10 +225,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, BlackHole) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath), dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(&BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback, base::BindOnce(
base::Unretained(this)), &BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback,
base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback, base::Unretained(this)),
base::Unretained(this))); base::BindOnce(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
base::Unretained(this)));
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
...@@ -267,10 +268,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) { ...@@ -267,10 +268,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath), dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(&BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback, base::BindOnce(
base::Unretained(this)), &BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback,
base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback, base::Unretained(this)),
base::Unretained(this))); base::BindOnce(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
base::Unretained(this)));
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
...@@ -282,10 +284,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) { ...@@ -282,10 +284,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath), dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(&BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback, base::BindOnce(
base::Unretained(this)), &BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback,
base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback, base::Unretained(this)),
base::Unretained(this))); base::BindOnce(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
base::Unretained(this)));
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
...@@ -298,10 +301,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) { ...@@ -298,10 +301,11 @@ TEST_F(BluetoothAdapterProfileBlueZTest, Routing) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath), dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath),
bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
base::Bind(&BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback, base::BindOnce(
base::Unretained(this)), &BluetoothAdapterProfileBlueZTest::DBusConnectSuccessCallback,
base::Bind(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback, base::Unretained(this)),
base::Unretained(this))); base::BindOnce(&BluetoothAdapterProfileBlueZTest::DBusErrorCallback,
base::Unretained(this)));
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
......
...@@ -99,7 +99,7 @@ void BluetoothAdvertisementBlueZ::Register( ...@@ -99,7 +99,7 @@ void BluetoothAdvertisementBlueZ::Register(
->GetBluetoothLEAdvertisingManagerClient() ->GetBluetoothLEAdvertisingManagerClient()
->RegisterAdvertisement( ->RegisterAdvertisement(
adapter_path_, provider_->object_path(), success_callback, adapter_path_, provider_->object_path(), success_callback,
base::Bind(&RegisterErrorCallbackConnector, error_callback)); base::BindOnce(&RegisterErrorCallbackConnector, error_callback));
} }
BluetoothAdvertisementBlueZ::~BluetoothAdvertisementBlueZ() { BluetoothAdvertisementBlueZ::~BluetoothAdvertisementBlueZ() {
...@@ -122,7 +122,7 @@ void BluetoothAdvertisementBlueZ::Unregister( ...@@ -122,7 +122,7 @@ void BluetoothAdvertisementBlueZ::Unregister(
->GetBluetoothLEAdvertisingManagerClient() ->GetBluetoothLEAdvertisingManagerClient()
->UnregisterAdvertisement( ->UnregisterAdvertisement(
adapter_path_, provider_->object_path(), success_callback, adapter_path_, provider_->object_path(), success_callback,
base::Bind(&UnregisterErrorCallbackConnector, error_callback)); base::BindOnce(&UnregisterErrorCallbackConnector, error_callback));
provider_.reset(); provider_.reset();
} }
......
...@@ -458,10 +458,10 @@ void BluetoothDeviceBlueZ::GetConnectionInfo( ...@@ -458,10 +458,10 @@ void BluetoothDeviceBlueZ::GetConnectionInfo(
// currently connected. // currently connected.
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetConnInfo( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetConnInfo(
object_path_, object_path_,
base::Bind(&BluetoothDeviceBlueZ::OnGetConnInfo, base::BindOnce(&BluetoothDeviceBlueZ::OnGetConnInfo,
weak_ptr_factory_.GetWeakPtr(), callback), weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothDeviceBlueZ::OnGetConnInfoError, base::BindOnce(&BluetoothDeviceBlueZ::OnGetConnInfoError,
weak_ptr_factory_.GetWeakPtr(), callback)); weak_ptr_factory_.GetWeakPtr(), callback));
} }
void BluetoothDeviceBlueZ::SetConnectionLatency( void BluetoothDeviceBlueZ::SetConnectionLatency(
...@@ -499,10 +499,10 @@ void BluetoothDeviceBlueZ::SetConnectionLatency( ...@@ -499,10 +499,10 @@ void BluetoothDeviceBlueZ::SetConnectionLatency(
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient(); bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient();
client->SetLEConnectionParameters( client->SetLEConnectionParameters(
object_path_, connection_parameters, object_path_, connection_parameters,
base::Bind(&BluetoothDeviceBlueZ::OnSetLEConnectionParameters, base::BindOnce(&BluetoothDeviceBlueZ::OnSetLEConnectionParameters,
weak_ptr_factory_.GetWeakPtr(), callback), weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothDeviceBlueZ::OnSetLEConnectionParametersError, base::BindOnce(&BluetoothDeviceBlueZ::OnSetLEConnectionParametersError,
weak_ptr_factory_.GetWeakPtr(), error_callback)); weak_ptr_factory_.GetWeakPtr(), error_callback));
} }
void BluetoothDeviceBlueZ::Connect( void BluetoothDeviceBlueZ::Connect(
...@@ -556,11 +556,11 @@ void BluetoothDeviceBlueZ::Connect( ...@@ -556,11 +556,11 @@ void BluetoothDeviceBlueZ::Connect(
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Pair( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Pair(
object_path_, object_path_,
base::Bind(&BluetoothDeviceBlueZ::OnPairDuringConnect, base::BindOnce(&BluetoothDeviceBlueZ::OnPairDuringConnect,
weak_ptr_factory_.GetWeakPtr(), dupe_callback, weak_ptr_factory_.GetWeakPtr(), dupe_callback,
dupe_error_callback), dupe_error_callback),
base::Bind(&BluetoothDeviceBlueZ::OnPairDuringConnectError, base::BindOnce(&BluetoothDeviceBlueZ::OnPairDuringConnectError,
weak_ptr_factory_.GetWeakPtr(), dupe_error_callback)); weak_ptr_factory_.GetWeakPtr(), dupe_error_callback));
} }
} }
...@@ -625,8 +625,8 @@ void BluetoothDeviceBlueZ::CancelPairing() { ...@@ -625,8 +625,8 @@ void BluetoothDeviceBlueZ::CancelPairing() {
<< "Sending explicit cancel"; << "Sending explicit cancel";
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->CancelPairing( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->CancelPairing(
object_path_, base::DoNothing(), object_path_, base::DoNothing(),
base::Bind(&BluetoothDeviceBlueZ::OnCancelPairingError, base::BindOnce(&BluetoothDeviceBlueZ::OnCancelPairingError,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
// Since there is no callback to this method it's possible that the pairing // Since there is no callback to this method it's possible that the pairing
...@@ -641,10 +641,10 @@ void BluetoothDeviceBlueZ::Disconnect(const base::Closure& callback, ...@@ -641,10 +641,10 @@ void BluetoothDeviceBlueZ::Disconnect(const base::Closure& callback,
BLUETOOTH_LOG(EVENT) << object_path_.value() << ": Disconnecting"; BLUETOOTH_LOG(EVENT) << object_path_.value() << ": Disconnecting";
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Disconnect( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Disconnect(
object_path_, object_path_,
base::Bind(&BluetoothDeviceBlueZ::OnDisconnect, base::BindOnce(&BluetoothDeviceBlueZ::OnDisconnect,
weak_ptr_factory_.GetWeakPtr(), callback), weak_ptr_factory_.GetWeakPtr(), callback),
base::Bind(&BluetoothDeviceBlueZ::OnDisconnectError, base::BindOnce(&BluetoothDeviceBlueZ::OnDisconnectError,
weak_ptr_factory_.GetWeakPtr(), error_callback)); weak_ptr_factory_.GetWeakPtr(), error_callback));
} }
void BluetoothDeviceBlueZ::Forget(const base::Closure& callback, void BluetoothDeviceBlueZ::Forget(const base::Closure& callback,
...@@ -652,8 +652,8 @@ void BluetoothDeviceBlueZ::Forget(const base::Closure& callback, ...@@ -652,8 +652,8 @@ void BluetoothDeviceBlueZ::Forget(const base::Closure& callback,
BLUETOOTH_LOG(EVENT) << object_path_.value() << ": Removing device"; BLUETOOTH_LOG(EVENT) << object_path_.value() << ": Removing device";
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveDevice( bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveDevice(
adapter()->object_path(), object_path_, callback, adapter()->object_path(), object_path_, callback,
base::Bind(&BluetoothDeviceBlueZ::OnForgetError, base::BindOnce(&BluetoothDeviceBlueZ::OnForgetError,
weak_ptr_factory_.GetWeakPtr(), error_callback)); weak_ptr_factory_.GetWeakPtr(), error_callback));
} }
void BluetoothDeviceBlueZ::ConnectToService( void BluetoothDeviceBlueZ::ConnectToService(
...@@ -694,8 +694,8 @@ void BluetoothDeviceBlueZ::GetServiceRecords( ...@@ -694,8 +694,8 @@ void BluetoothDeviceBlueZ::GetServiceRecords(
const GetServiceRecordsErrorCallback& error_callback) { const GetServiceRecordsErrorCallback& error_callback) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetServiceRecords( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetServiceRecords(
object_path_, callback, object_path_, callback,
base::Bind(&BluetoothDeviceBlueZ::OnGetServiceRecordsError, base::BindOnce(&BluetoothDeviceBlueZ::OnGetServiceRecordsError,
weak_ptr_factory_.GetWeakPtr(), error_callback)); weak_ptr_factory_.GetWeakPtr(), error_callback));
} }
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -704,8 +704,8 @@ void BluetoothDeviceBlueZ::ExecuteWrite( ...@@ -704,8 +704,8 @@ void BluetoothDeviceBlueZ::ExecuteWrite(
const ExecuteWriteErrorCallback& error_callback) { const ExecuteWriteErrorCallback& error_callback) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ExecuteWrite( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ExecuteWrite(
object_path_, callback, object_path_, callback,
base::Bind(&BluetoothDeviceBlueZ::OnExecuteWriteError, base::BindOnce(&BluetoothDeviceBlueZ::OnExecuteWriteError,
weak_ptr_factory_.GetWeakPtr(), error_callback)); weak_ptr_factory_.GetWeakPtr(), error_callback));
} }
void BluetoothDeviceBlueZ::AbortWrite( void BluetoothDeviceBlueZ::AbortWrite(
...@@ -713,8 +713,8 @@ void BluetoothDeviceBlueZ::AbortWrite( ...@@ -713,8 +713,8 @@ void BluetoothDeviceBlueZ::AbortWrite(
const AbortWriteErrorCallback& error_callback) { const AbortWriteErrorCallback& error_callback) {
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AbortWrite( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AbortWrite(
object_path_, callback, object_path_, callback,
base::Bind(&BluetoothDeviceBlueZ::OnAbortWriteError, base::BindOnce(&BluetoothDeviceBlueZ::OnAbortWriteError,
weak_ptr_factory_.GetWeakPtr(), error_callback)); weak_ptr_factory_.GetWeakPtr(), error_callback));
} }
#endif #endif
...@@ -1076,8 +1076,8 @@ void BluetoothDeviceBlueZ::SetTrusted() { ...@@ -1076,8 +1076,8 @@ void BluetoothDeviceBlueZ::SetTrusted() {
bluez::BluezDBusManager::Get() bluez::BluezDBusManager::Get()
->GetBluetoothDeviceClient() ->GetBluetoothDeviceClient()
->GetProperties(object_path_) ->GetProperties(object_path_)
->trusted.Set(true, base::Bind(&BluetoothDeviceBlueZ::OnSetTrusted, ->trusted.Set(true, base::BindOnce(&BluetoothDeviceBlueZ::OnSetTrusted,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
void BluetoothDeviceBlueZ::OnSetTrusted(bool success) { void BluetoothDeviceBlueZ::OnSetTrusted(bool success) {
...@@ -1114,10 +1114,10 @@ void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, ...@@ -1114,10 +1114,10 @@ void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback,
void BluetoothDeviceBlueZ::UnpauseDiscovery() { void BluetoothDeviceBlueZ::UnpauseDiscovery() {
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->UnpauseDiscovery( bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->UnpauseDiscovery(
adapter()->object_path(), base::Bind([]() { adapter()->object_path(), base::BindOnce([]() {
BLUETOOTH_LOG(EVENT) << "Successfully un-paused discovery"; BLUETOOTH_LOG(EVENT) << "Successfully un-paused discovery";
}), }),
base::Bind( base::BindOnce(
[](const std::string& error_name, const std::string& error_message) { [](const std::string& error_name, const std::string& error_message) {
BLUETOOTH_LOG(EVENT) << "Failed to un-pause discovery"; BLUETOOTH_LOG(EVENT) << "Failed to un-pause discovery";
})); }));
......
...@@ -263,10 +263,10 @@ void BluetoothSocketBlueZ::OnRegisterProfile( ...@@ -263,10 +263,10 @@ void BluetoothSocketBlueZ::OnRegisterProfile(
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
device_path_, uuid_.canonical_value(), device_path_, uuid_.canonical_value(),
base::Bind(&BluetoothSocketBlueZ::OnConnectProfile, this, base::BindOnce(&BluetoothSocketBlueZ::OnConnectProfile, this,
success_callback), success_callback),
base::Bind(&BluetoothSocketBlueZ::OnConnectProfileError, this, base::BindOnce(&BluetoothSocketBlueZ::OnConnectProfileError, this,
error_callback)); error_callback));
} }
void BluetoothSocketBlueZ::OnRegisterProfileError( void BluetoothSocketBlueZ::OnRegisterProfileError(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment