Index: chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc |
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc |
index 7c533c6f9000bd7acaacd4d36fa3d13d8a866c02..0fdc9a6b63c6ba2d1fda168b06ccacd3f6f5590e 100644 |
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc |
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc |
@@ -4,11 +4,13 @@ |
#include "chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h" |
+#include <memory> |
#include <string> |
#include <utility> |
#include "base/bind.h" |
#include "base/logging.h" |
+#include "base/memory/ptr_util.h" |
#include "base/strings/stringprintf.h" |
#include "chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h" |
#include "chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.h" |
@@ -105,12 +107,12 @@ void SyncFileSystemDeleteFileSystemFunction::DidDeleteFileSystem( |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
if (error != base::File::FILE_OK) { |
error_ = ErrorToString(sync_file_system::FileErrorToSyncStatusCode(error)); |
- SetResult(new base::FundamentalValue(false)); |
+ SetResult(base::MakeUnique<base::FundamentalValue>(false)); |
SendResponse(false); |
return; |
} |
- SetResult(new base::FundamentalValue(true)); |
+ SetResult(base::MakeUnique<base::FundamentalValue>(true)); |
SendResponse(true); |
} |
@@ -163,10 +165,10 @@ void SyncFileSystemRequestFileSystemFunction::DidOpenFileSystem( |
return; |
} |
- base::DictionaryValue* dict = new base::DictionaryValue(); |
- SetResult(dict); |
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
dict->SetString("name", file_system_name); |
dict->SetString("root", root_url.spec()); |
+ SetResult(std::move(dict)); |
SendResponse(true); |
} |
@@ -270,7 +272,7 @@ void SyncFileSystemGetFileStatusesFunction::DidGetFileStatus( |
// Note that the enum types need to be set as strings manually as the |
// autogenerated Results::Create function thinks the enum values should be |
// returned as int values. |
- base::ListValue* status_array = new base::ListValue(); |
+ std::unique_ptr<base::ListValue> status_array(new base::ListValue()); |
for (URLToStatusMap::iterator it = file_sync_statuses_.begin(); |
it != file_sync_statuses_.end(); ++it) { |
base::DictionaryValue* dict = new base::DictionaryValue(); |
@@ -289,7 +291,7 @@ void SyncFileSystemGetFileStatusesFunction::DidGetFileStatus( |
continue; |
dict->SetString("error", ErrorToString(file_error)); |
} |
- SetResult(status_array); |
+ SetResult(std::move(status_array)); |
SendResponse(true); |
} |
@@ -366,9 +368,8 @@ bool SyncFileSystemSetConflictResolutionPolicyFunction::RunSync() { |
} |
bool SyncFileSystemGetConflictResolutionPolicyFunction::RunSync() { |
- SetResult(new base::StringValue( |
- api::sync_file_system::ToString( |
- api::sync_file_system::CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN))); |
+ SetResult(base::MakeUnique<base::StringValue>(api::sync_file_system::ToString( |
+ api::sync_file_system::CONFLICT_RESOLUTION_POLICY_LAST_WRITE_WIN))); |
return true; |
} |