Index: chrome/browser/extensions/api/autotest_private/autotest_private_api.cc |
diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc |
index 8005c8ead7fddb932e7c91f8f587ded746060f81..e50590e4ca262775a3b410c6363cb665ce1e3afe 100644 |
--- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc |
+++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc |
@@ -10,6 +10,7 @@ |
#include "base/lazy_instance.h" |
#include "base/memory/ptr_util.h" |
#include "base/strings/string_number_conversions.h" |
+#include "base/values.h" |
#include "build/build_config.h" |
#include "chrome/browser/extensions/extension_action_manager.h" |
#include "chrome/browser/extensions/extension_service.h" |
@@ -40,13 +41,14 @@ |
namespace extensions { |
namespace { |
-base::ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { |
+std::unique_ptr<base::ListValue> GetHostPermissions(const Extension* ext, |
+ bool effective_perm) { |
const PermissionsData* permissions_data = ext->permissions_data(); |
const URLPatternSet& pattern_set = |
effective_perm ? permissions_data->GetEffectiveHostPermissions() |
: permissions_data->active_permissions().explicit_hosts(); |
- base::ListValue* permissions = new base::ListValue; |
+ auto permissions = base::MakeUnique<base::ListValue>(); |
for (URLPatternSet::const_iterator perm = pattern_set.begin(); |
perm != pattern_set.end(); |
++perm) { |
@@ -56,8 +58,8 @@ base::ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) { |
return permissions; |
} |
-base::ListValue* GetAPIPermissions(const Extension* ext) { |
- base::ListValue* permissions = new base::ListValue; |
+std::unique_ptr<base::ListValue> GetAPIPermissions(const Extension* ext) { |
+ auto permissions = base::MakeUnique<base::ListValue>(); |
std::set<std::string> perm_list = |
ext->permissions_data()->active_permissions().GetAPIsAsStrings(); |
for (std::set<std::string>::const_iterator perm = perm_list.begin(); |
@@ -166,7 +168,7 @@ AutotestPrivateGetExtensionsInfoFunction::Run() { |
ExtensionActionManager* extension_action_manager = |
ExtensionActionManager::Get(browser_context()); |
- base::ListValue* extensions_values = new base::ListValue; |
+ auto extensions_values = base::MakeUnique<base::ListValue>(); |
ExtensionList all; |
all.insert(all.end(), extensions.begin(), extensions.end()); |
all.insert(all.end(), disabled_extensions.begin(), disabled_extensions.end()); |
@@ -212,7 +214,7 @@ AutotestPrivateGetExtensionsInfoFunction::Run() { |
std::unique_ptr<base::DictionaryValue> return_value( |
new base::DictionaryValue); |
- return_value->Set("extensions", extensions_values); |
+ return_value->Set("extensions", std::move(extensions_values)); |
return RespondNow(OneArgument(std::move(return_value))); |
} |