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

Unified Diff: chrome/browser/chromeos/extensions/file_manager/private_api_file_system.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: chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
index 1cc3dfcc2c6d25d2953d995d0d6bbd6901940688..2d0b1831946ad0391559ab6a7212a004cf718b47 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
@@ -7,6 +7,7 @@
#include <sys/statvfs.h>
#include <set>
+#include <utility>
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
@@ -328,7 +329,7 @@ ExtensionFunction::ResponseAction FileManagerPrivateGrantAccessFunction::Run() {
void FileWatchFunctionBase::Respond(bool success) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- SetResult(new base::FundamentalValue(success));
+ SetResult(base::MakeUnique<base::FundamentalValue>(success));
SendResponse(success);
}
@@ -531,12 +532,12 @@ void FileManagerPrivateGetSizeStatsFunction::OnGetMtpAvailableSpace(
void FileManagerPrivateGetSizeStatsFunction::OnGetSizeStats(
const uint64_t* total_size,
const uint64_t* remaining_size) {
- base::DictionaryValue* sizes = new base::DictionaryValue();
- SetResult(sizes);
+ std::unique_ptr<base::DictionaryValue> sizes(new base::DictionaryValue());
sizes->SetDouble("totalSize", static_cast<double>(*total_size));
sizes->SetDouble("remainingSize", static_cast<double>(*remaining_size));
+ SetResult(std::move(sizes));
SendResponse(true);
}
@@ -557,7 +558,7 @@ bool FileManagerPrivateInternalValidatePathNameLengthFunction::RunAsync() {
// No explicit limit on the length of Drive file names.
if (file_system_url.type() == storage::kFileSystemTypeDrive) {
- SetResult(new base::FundamentalValue(true));
+ SetResult(base::MakeUnique<base::FundamentalValue>(true));
SendResponse(true);
return true;
}
@@ -574,7 +575,8 @@ bool FileManagerPrivateInternalValidatePathNameLengthFunction::RunAsync() {
void FileManagerPrivateInternalValidatePathNameLengthFunction::
OnFilePathLimitRetrieved(size_t current_length, size_t max_length) {
- SetResult(new base::FundamentalValue(current_length <= max_length));
+ SetResult(
+ base::MakeUnique<base::FundamentalValue>(current_length <= max_length));
SendResponse(true);
}
@@ -734,7 +736,7 @@ void FileManagerPrivateInternalStartCopyFunction::RunAfterStartCopy(
int operation_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- SetResult(new base::FundamentalValue(operation_id));
+ SetResult(base::MakeUnique<base::FundamentalValue>(operation_id));
SendResponse(true);
}
@@ -875,7 +877,7 @@ bool FileManagerPrivateInternalComputeChecksumFunction::RunAsync() {
void FileManagerPrivateInternalComputeChecksumFunction::Respond(
const std::string& hash) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- SetResult(new base::StringValue(hash));
+ SetResult(base::MakeUnique<base::StringValue>(hash));
SendResponse(true);
}
@@ -937,7 +939,7 @@ void FileManagerPrivateSearchFilesByHashesFunction::OnSearchByHashes(
file_manager::util::ConvertDrivePathToFileSystemUrl(
GetProfile(), hashAndPath.path, extension_id()).spec());
}
- SetResult(result.release());
+ SetResult(std::move(result));
SendResponse(true);
}

Powered by Google App Engine
This is Rietveld 408576698