Index: chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc |
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc |
index 1ac35ebe0e965ab3ba046f0bc40633826da63ee0..a212b146321e4a7a6c302c80c690e6a1fd49c293 100644 |
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc |
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc |
@@ -276,6 +276,30 @@ bool BluetoothPrivateSetPairingResponseFunction::DoWork( |
return true; |
} |
+BluetoothPrivateGetDeviceRSSIFunction:: |
+ BluetoothPrivateGetDeviceRSSIFunction() {} |
+ |
+BluetoothPrivateGetDeviceRSSIFunction:: |
+ ~BluetoothPrivateGetDeviceRSSIFunction() {} |
+ |
+bool BluetoothPrivateGetDeviceRSSIFunction::DoWork( |
+ scoped_refptr<device::BluetoothAdapter> adapter) { |
+ scoped_ptr<bt_private::GetDeviceRSSI::Params> params( |
+ bt_private::GetDeviceRSSI::Params::Create(*args_)); |
+ EXTENSION_FUNCTION_VALIDATE(params.get()); |
+ const std::string& device_address = params->address; |
+ device::BluetoothDevice* device = adapter->GetDevice(device_address); |
+ if (!device) { |
+ SetError(kDeviceNotFoundError); |
+ SendResponse(false); |
+ return false; |
+ } |
+ |
+ results_ = bt_private::GetDeviceRSSI::Results::Create(device->GetRSSI()); |
+ SendResponse(true); |
+ return true; |
+} |
+ |
} // namespace api |
} // namespace extensions |