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

Unified Diff: extensions/browser/api/hid/hid_api.cc

Issue 2038613003: Revert of ExtensionFunction: don't pass ownership of base::Value by raw pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/hid/hid_api.cc
diff --git a/extensions/browser/api/hid/hid_api.cc b/extensions/browser/api/hid/hid_api.cc
index b03ae8baaa7b704bd1e59158372d69b6c36e2dd3..bbf59b8746dd496b5024103737422cd4c59f72ba 100644
--- a/extensions/browser/api/hid/hid_api.cc
+++ b/extensions/browser/api/hid/hid_api.cc
@@ -7,10 +7,8 @@
#include <stdint.h>
#include <string>
-#include <utility>
#include <vector>
-#include "base/memory/ptr_util.h"
#include "device/core/device_client.h"
#include "device/hid/hid_connection.h"
#include "device/hid/hid_device_filter.h"
@@ -58,12 +56,11 @@
const char kErrorConnectionNotFound[] = "Connection not established.";
const char kErrorTransfer[] = "Transfer failed.";
-std::unique_ptr<base::Value> PopulateHidConnection(
- int connection_id,
- scoped_refptr<HidConnection> connection) {
+base::Value* PopulateHidConnection(int connection_id,
+ scoped_refptr<HidConnection> connection) {
hid::HidConnectInfo connection_value;
connection_value.connection_id = connection_id;
- return connection_value.ToValue();
+ return connection_value.ToValue().release();
}
void ConvertHidDeviceFilter(const hid::DeviceFilter& input,
@@ -122,7 +119,7 @@
void HidGetDevicesFunction::OnEnumerationComplete(
std::unique_ptr<base::ListValue> devices) {
- Respond(OneArgument(std::move(devices)));
+ Respond(OneArgument(devices.release()));
}
HidGetUserSelectedDevicesFunction::HidGetUserSelectedDevicesFunction() {
@@ -138,7 +135,7 @@
content::WebContents* web_contents = GetSenderWebContents();
if (!web_contents || !user_gesture()) {
- return RespondNow(OneArgument(base::MakeUnique<base::ListValue>()));
+ return RespondNow(OneArgument(new base::ListValue()));
}
bool multiple = false;
@@ -290,10 +287,9 @@
DCHECK_GE(size, 1u);
int report_id = reinterpret_cast<uint8_t*>(buffer->data())[0];
- Respond(
- TwoArguments(base::MakeUnique<base::FundamentalValue>(report_id),
- base::WrapUnique(base::BinaryValue::CreateWithCopiedBuffer(
- buffer->data() + 1, size - 1))));
+ Respond(TwoArguments(new base::FundamentalValue(report_id),
+ base::BinaryValue::CreateWithCopiedBuffer(
+ buffer->data() + 1, size - 1)));
} else {
Respond(Error(kErrorTransfer));
}
@@ -350,8 +346,8 @@
scoped_refptr<net::IOBuffer> buffer,
size_t size) {
if (success) {
- Respond(OneArgument(base::WrapUnique(
- base::BinaryValue::CreateWithCopiedBuffer(buffer->data(), size))));
+ Respond(OneArgument(
+ base::BinaryValue::CreateWithCopiedBuffer(buffer->data(), size)));
} else {
Respond(Error(kErrorTransfer));
}

Powered by Google App Engine
This is Rietveld 408576698