summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorstevenjb <stevenjb@chromium.org>2015-11-12 15:14:57 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-12 23:16:24 +0000
commit5661293922b3e6b90e87bff3e4bc50aafe6ce033 (patch)
treed01b2e5a16de7159647395e4da45a1d59f111201 /device
parent86c81bb1cbb09a2df4b70e6912f5950c90e245d6 (diff)
downloadchromium_src-5661293922b3e6b90e87bff3e4bc50aafe6ce033.zip
chromium_src-5661293922b3e6b90e87bff3e4bc50aafe6ce033.tar.gz
chromium_src-5661293922b3e6b90e87bff3e4bc50aafe6ce033.tar.bz2
Implement bluetoothPrivate.forget
One last method we need in bluetoothPrivate for settings. BUG=543294 Review URL: https://codereview.chromium.org/1429283002 Cr-Commit-Position: refs/heads/master@{#359426}
Diffstat (limited to 'device')
-rw-r--r--device/bluetooth/bluetooth_bluez_unittest.cc4
-rw-r--r--device/bluetooth/bluetooth_classic_device_mac.h3
-rw-r--r--device/bluetooth/bluetooth_classic_device_mac.mm3
-rw-r--r--device/bluetooth/bluetooth_device.h7
-rw-r--r--device/bluetooth/bluetooth_device_android.cc3
-rw-r--r--device/bluetooth/bluetooth_device_android.h3
-rw-r--r--device/bluetooth/bluetooth_device_bluez.cc5
-rw-r--r--device/bluetooth/bluetooth_device_bluez.h3
-rw-r--r--device/bluetooth/bluetooth_device_win.cc3
-rw-r--r--device/bluetooth/bluetooth_device_win.h3
-rw-r--r--device/bluetooth/bluetooth_low_energy_device_mac.h3
-rw-r--r--device/bluetooth/bluetooth_low_energy_device_mac.mm3
-rw-r--r--device/bluetooth/test/mock_bluetooth_device.h4
13 files changed, 30 insertions, 17 deletions
diff --git a/device/bluetooth/bluetooth_bluez_unittest.cc b/device/bluetooth/bluetooth_bluez_unittest.cc
index 315a704..e82d04d 100644
--- a/device/bluetooth/bluetooth_bluez_unittest.cc
+++ b/device/bluetooth/bluetooth_bluez_unittest.cc
@@ -2360,7 +2360,7 @@ TEST_F(BluetoothBlueZTest, ForgetDevice) {
// with the device we remove.
TestBluetoothAdapterObserver observer(adapter_);
- devices[idx]->Forget(GetErrorCallback());
+ devices[idx]->Forget(base::Bind(&base::DoNothing), GetErrorCallback());
EXPECT_EQ(0, error_callback_count_);
EXPECT_EQ(1, observer.device_removed_count());
@@ -2402,7 +2402,7 @@ TEST_F(BluetoothBlueZTest, ForgetUnpairedDevice) {
// with the device we remove.
TestBluetoothAdapterObserver observer(adapter_);
- device->Forget(GetErrorCallback());
+ device->Forget(base::Bind(&base::DoNothing), GetErrorCallback());
EXPECT_EQ(0, error_callback_count_);
EXPECT_EQ(1, observer.device_removed_count());
diff --git a/device/bluetooth/bluetooth_classic_device_mac.h b/device/bluetooth/bluetooth_classic_device_mac.h
index 16bfea8..c456505 100644
--- a/device/bluetooth/bluetooth_classic_device_mac.h
+++ b/device/bluetooth/bluetooth_classic_device_mac.h
@@ -55,7 +55,8 @@ class BluetoothClassicDeviceMac : public BluetoothDeviceMac {
void CancelPairing() override;
void Disconnect(const base::Closure& callback,
const ErrorCallback& error_callback) override;
- void Forget(const ErrorCallback& error_callback) override;
+ void Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
void ConnectToService(
const BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
diff --git a/device/bluetooth/bluetooth_classic_device_mac.mm b/device/bluetooth/bluetooth_classic_device_mac.mm
index e524e81..a472f86 100644
--- a/device/bluetooth/bluetooth_classic_device_mac.mm
+++ b/device/bluetooth/bluetooth_classic_device_mac.mm
@@ -217,7 +217,8 @@ void BluetoothClassicDeviceMac::Disconnect(
NOTIMPLEMENTED();
}
-void BluetoothClassicDeviceMac::Forget(const ErrorCallback& error_callback) {
+void BluetoothClassicDeviceMac::Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) {
NOTIMPLEMENTED();
}
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index a7ca42c..809417d 100644
--- a/device/bluetooth/bluetooth_device.h
+++ b/device/bluetooth/bluetooth_device.h
@@ -376,9 +376,10 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// and other pairing information. The device object remains valid until
// returning from the calling function, after which it should be assumed to
// have been deleted. If the request fails, |error_callback| will be called.
- // There is no callback for success because this object is often deleted
- // before that callback would be called.
- virtual void Forget(const ErrorCallback& error_callback) = 0;
+ // On success |callback| will be invoked, but note that the BluetoothDevice
+ // object will have been deleted at that point.
+ virtual void Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) = 0;
// Attempts to initiate an outgoing L2CAP or RFCOMM connection to the
// advertised service on this device matching |uuid|, performing an SDP lookup
diff --git a/device/bluetooth/bluetooth_device_android.cc b/device/bluetooth/bluetooth_device_android.cc
index ecb1097..e817350 100644
--- a/device/bluetooth/bluetooth_device_android.cc
+++ b/device/bluetooth/bluetooth_device_android.cc
@@ -181,7 +181,8 @@ void BluetoothDeviceAndroid::Disconnect(const base::Closure& callback,
NOTIMPLEMENTED();
}
-void BluetoothDeviceAndroid::Forget(const ErrorCallback& error_callback) {
+void BluetoothDeviceAndroid::Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) {
NOTIMPLEMENTED();
}
diff --git a/device/bluetooth/bluetooth_device_android.h b/device/bluetooth/bluetooth_device_android.h
index be9df2a..5f63a6d 100644
--- a/device/bluetooth/bluetooth_device_android.h
+++ b/device/bluetooth/bluetooth_device_android.h
@@ -77,7 +77,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceAndroid final
void CancelPairing() override;
void Disconnect(const base::Closure& callback,
const ErrorCallback& error_callback) override;
- void Forget(const ErrorCallback& error_callback) override;
+ void Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
void ConnectToService(
const device::BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
diff --git a/device/bluetooth/bluetooth_device_bluez.cc b/device/bluetooth/bluetooth_device_bluez.cc
index a2b056b..69ac80d 100644
--- a/device/bluetooth/bluetooth_device_bluez.cc
+++ b/device/bluetooth/bluetooth_device_bluez.cc
@@ -454,10 +454,11 @@ void BluetoothDeviceBlueZ::Disconnect(const base::Closure& callback,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
-void BluetoothDeviceBlueZ::Forget(const ErrorCallback& error_callback) {
+void BluetoothDeviceBlueZ::Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Removing device";
bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveDevice(
- adapter()->object_path(), object_path_, base::Bind(&base::DoNothing),
+ adapter()->object_path(), object_path_, callback,
base::Bind(&BluetoothDeviceBlueZ::OnForgetError,
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
diff --git a/device/bluetooth/bluetooth_device_bluez.h b/device/bluetooth/bluetooth_device_bluez.h
index 8d93f30..aa54686 100644
--- a/device/bluetooth/bluetooth_device_bluez.h
+++ b/device/bluetooth/bluetooth_device_bluez.h
@@ -67,7 +67,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ
void CancelPairing() override;
void Disconnect(const base::Closure& callback,
const ErrorCallback& error_callback) override;
- void Forget(const ErrorCallback& error_callback) override;
+ void Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
void ConnectToService(
const device::BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
diff --git a/device/bluetooth/bluetooth_device_win.cc b/device/bluetooth/bluetooth_device_win.cc
index 4d7d2a9..1efd638 100644
--- a/device/bluetooth/bluetooth_device_win.cc
+++ b/device/bluetooth/bluetooth_device_win.cc
@@ -158,7 +158,8 @@ void BluetoothDeviceWin::Disconnect(
NOTIMPLEMENTED();
}
-void BluetoothDeviceWin::Forget(const ErrorCallback& error_callback) {
+void BluetoothDeviceWin::Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) {
NOTIMPLEMENTED();
}
diff --git a/device/bluetooth/bluetooth_device_win.h b/device/bluetooth/bluetooth_device_win.h
index f1019a0..cfc3f87 100644
--- a/device/bluetooth/bluetooth_device_win.h
+++ b/device/bluetooth/bluetooth_device_win.h
@@ -60,7 +60,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin : public BluetoothDevice {
void CancelPairing() override;
void Disconnect(const base::Closure& callback,
const ErrorCallback& error_callback) override;
- void Forget(const ErrorCallback& error_callback) override;
+ void Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
void ConnectToService(
const BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
diff --git a/device/bluetooth/bluetooth_low_energy_device_mac.h b/device/bluetooth/bluetooth_low_energy_device_mac.h
index 711fd20..863cb10 100644
--- a/device/bluetooth/bluetooth_low_energy_device_mac.h
+++ b/device/bluetooth/bluetooth_low_energy_device_mac.h
@@ -64,7 +64,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyDeviceMac
void CancelPairing() override;
void Disconnect(const base::Closure& callback,
const ErrorCallback& error_callback) override;
- void Forget(const ErrorCallback& error_callback) override;
+ void Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
void ConnectToService(
const BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
diff --git a/device/bluetooth/bluetooth_low_energy_device_mac.mm b/device/bluetooth/bluetooth_low_energy_device_mac.mm
index 99ec7cd..64b7492 100644
--- a/device/bluetooth/bluetooth_low_energy_device_mac.mm
+++ b/device/bluetooth/bluetooth_low_energy_device_mac.mm
@@ -193,7 +193,8 @@ void BluetoothLowEnergyDeviceMac::Disconnect(
NOTIMPLEMENTED();
}
-void BluetoothLowEnergyDeviceMac::Forget(const ErrorCallback& error_callback) {
+void BluetoothLowEnergyDeviceMac::Forget(const base::Closure& callback,
+ const ErrorCallback& error_callback) {
NOTIMPLEMENTED();
}
diff --git a/device/bluetooth/test/mock_bluetooth_device.h b/device/bluetooth/test/mock_bluetooth_device.h
index fed356d..a19937c 100644
--- a/device/bluetooth/test/mock_bluetooth_device.h
+++ b/device/bluetooth/test/mock_bluetooth_device.h
@@ -69,7 +69,9 @@ class MockBluetoothDevice : public BluetoothDevice {
MOCK_METHOD2(Disconnect,
void(const base::Closure& callback,
const BluetoothDevice::ErrorCallback& error_callback));
- MOCK_METHOD1(Forget, void(const BluetoothDevice::ErrorCallback&));
+ MOCK_METHOD2(Forget,
+ void(const base::Closure& callback,
+ const BluetoothDevice::ErrorCallback& error_callback));
MOCK_METHOD3(ConnectToService,
void(const BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,