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

Unified Diff: chrome/browser/extensions/api/identity/identity_api.cc

Issue 2025103003: 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: chrome/browser/extensions/api/identity/identity_api.cc
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index f018e140609a15b79d3888da79f49d909c447966..853fb7c5d254b885e01a3900003b7c3f9783ef99 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -292,7 +293,7 @@ ExtensionFunction::ResponseAction IdentityGetAccountsFunction::Run() {
IdentityAPI::GetFactoryInstance()->Get(GetProfile())->GetAccounts();
DCHECK(gaia_ids.size() < 2 || switches::IsExtensionsMultiAccount());
- base::ListValue* infos = new base::ListValue();
+ std::unique_ptr<base::ListValue> infos(new base::ListValue());
for (std::vector<std::string>::const_iterator it = gaia_ids.begin();
it != gaia_ids.end();
@@ -302,7 +303,7 @@ ExtensionFunction::ResponseAction IdentityGetAccountsFunction::Run() {
infos->Append(account_info.ToValue().release());
}
- return RespondNow(OneArgument(infos));
+ return RespondNow(OneArgument(std::move(infos)));
}
IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction()
@@ -917,7 +918,7 @@ ExtensionFunction::ResponseAction IdentityGetProfileUserInfoFunction::Run() {
profile_user_info.id = account.gaia;
}
- return RespondNow(OneArgument(profile_user_info.ToValue().release()));
+ return RespondNow(OneArgument(profile_user_info.ToValue()));
}
IdentityRemoveCachedAuthTokenFunction::IdentityRemoveCachedAuthTokenFunction() {

Powered by Google App Engine
This is Rietveld 408576698