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

Unified Diff: extensions/browser/api/web_request/upload_data_presenter.cc

Issue 2065793002: Return a unique_ptr from BinaryValue::CreateWithCopiedBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android and CrOS Created 4 years, 6 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/web_request/upload_data_presenter.cc
diff --git a/extensions/browser/api/web_request/upload_data_presenter.cc b/extensions/browser/api/web_request/upload_data_presenter.cc
index dbc6c9147432e21fa68b557e1ec214c7f3846c19..3bb1d8019d32e3a9af3e8be94df323a124cd9ac8 100644
--- a/extensions/browser/api/web_request/upload_data_presenter.cc
+++ b/extensions/browser/api/web_request/upload_data_presenter.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "extensions/browser/api/web_request/form_data_parser.h"
@@ -44,10 +45,10 @@ namespace extensions {
namespace subtle {
void AppendKeyValuePair(const char* key,
- base::Value* value,
+ std::unique_ptr<base::Value> value,
base::ListValue* list) {
std::unique_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue);
- dictionary->SetWithoutPathExpansion(key, value);
+ dictionary->SetWithoutPathExpansion(key, std::move(value));
list->Append(std::move(dictionary));
}
@@ -97,7 +98,7 @@ void RawDataPresenter::FeedNextBytes(const char* bytes, size_t size) {
void RawDataPresenter::FeedNextFile(const std::string& filename) {
// Insert the file path instead of the contents, which may be too large.
subtle::AppendKeyValuePair(keys::kRequestBodyRawFileKey,
- new base::StringValue(filename),
+ base::MakeUnique<base::StringValue>(filename),
list_.get());
}

Powered by Google App Engine
This is Rietveld 408576698