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

Unified Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc

Issue 2811673002: Reland: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Workaround with std::move Created 3 years, 8 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/extensions/api/sync_file_system/sync_file_system_api_helpers.cc
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc
index 6cfbf8a18624f63dac91d052c1e69ffe49797346..c191b3d18a96a86eda90b25b611d32034b43009c 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
+#include "base/values.h"
#include "storage/browser/fileapi/file_system_url.h"
#include "storage/common/fileapi/file_system_util.h"
@@ -105,11 +107,11 @@ ConflictResolutionPolicyToExtensionEnum(
return api::sync_file_system::CONFLICT_RESOLUTION_POLICY_NONE;
}
-base::DictionaryValue* CreateDictionaryValueForFileSystemEntry(
+std::unique_ptr<base::DictionaryValue> CreateDictionaryValueForFileSystemEntry(
const storage::FileSystemURL& url,
sync_file_system::SyncFileType file_type) {
if (!url.is_valid() || file_type == sync_file_system::SYNC_FILE_TYPE_UNKNOWN)
- return NULL;
+ return nullptr;
std::string file_path =
base::FilePath(storage::VirtualPath::GetNormalizedFilePath(url.path()))
@@ -122,7 +124,7 @@ base::DictionaryValue* CreateDictionaryValueForFileSystemEntry(
root_url.append("/");
}
- base::DictionaryValue* dict = new base::DictionaryValue;
+ auto dict = base::MakeUnique<base::DictionaryValue>();
dict->SetString("fileSystemType",
storage::GetFileSystemTypeString(url.mount_type()));
dict->SetString("fileSystemName",

Powered by Google App Engine
This is Rietveld 408576698