Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: extensions/browser/api/bluetooth/bluetooth_api.cc

Issue 1991083002: Remove ExtensionFunction::SetResult(T*) overload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/bluetooth/bluetooth_api.cc
diff --git a/extensions/browser/api/bluetooth/bluetooth_api.cc b/extensions/browser/api/bluetooth/bluetooth_api.cc
index 9c5fc508dd7bf84162e24ff1be3e3c172e55880e..6d0b00304af1248747dda41140935b030e3fc237 100644
--- a/extensions/browser/api/bluetooth/bluetooth_api.cc
+++ b/extensions/browser/api/bluetooth/bluetooth_api.cc
@@ -4,7 +4,9 @@
#include "extensions/browser/api/bluetooth/bluetooth_api.h"
+#include <memory>
#include <string>
+#include <utility>
#include "base/bind_helpers.h"
#include "base/lazy_instance.h"
@@ -115,8 +117,7 @@ bool BluetoothGetDevicesFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::ListValue* device_list = new base::ListValue;
- SetResult(device_list);
+ std::unique_ptr<base::ListValue> device_list(new base::ListValue);
BluetoothAdapter::DeviceList devices = adapter->GetDevices();
for (BluetoothAdapter::DeviceList::const_iterator iter = devices.begin();
@@ -131,6 +132,7 @@ bool BluetoothGetDevicesFunction::DoWork(
device_list->Append(extension_device.ToValue().release());
}
+ SetResult(std::move(device_list));
SendResponse(true);
return true;
@@ -149,7 +151,7 @@ bool BluetoothGetDeviceFunction::DoWork(
if (device) {
bluetooth::Device extension_device;
bluetooth::BluetoothDeviceToApiDevice(*device, &extension_device);
- SetResult(extension_device.ToValue().release());
+ SetResult(extension_device.ToValue());
SendResponse(true);
} else {
SetError(kInvalidDevice);

Powered by Google App Engine
This is Rietveld 408576698