Index: chrome/browser/ui/webui/options/language_options_handler_common.cc |
diff --git a/chrome/browser/ui/webui/options/language_options_handler_common.cc b/chrome/browser/ui/webui/options/language_options_handler_common.cc |
index 151d4d70b422827517737f4850fc91f20cc55013..fd127384e773e6139bb9f32a17eb41225ccf62d4 100644 |
--- a/chrome/browser/ui/webui/options/language_options_handler_common.cc |
+++ b/chrome/browser/ui/webui/options/language_options_handler_common.cc |
@@ -14,6 +14,7 @@ |
#include "base/bind.h" |
#include "base/command_line.h" |
#include "base/macros.h" |
+#include "base/memory/ptr_util.h" |
#include "base/metrics/user_metrics.h" |
#include "base/strings/string_util.h" |
#include "base/strings/stringprintf.h" |
@@ -117,13 +118,14 @@ void LanguageOptionsHandlerCommon::GetLocalizedValues( |
std::vector<std::string> languages; |
translate::TranslateDownloadManager::GetSupportedLanguages(&languages); |
- base::ListValue* languages_list = new base::ListValue(); |
+ auto languages_list = base::MakeUnique<base::ListValue>(); |
for (std::vector<std::string>::iterator it = languages.begin(); |
it != languages.end(); ++it) { |
languages_list->AppendString(*it); |
} |
- localized_strings->Set("translateSupportedLanguages", languages_list); |
+ localized_strings->Set("translateSupportedLanguages", |
+ std::move(languages_list)); |
} |
void LanguageOptionsHandlerCommon::Uninitialize() { |
@@ -183,8 +185,9 @@ void LanguageOptionsHandlerCommon::OnHunspellDictionaryDownloadFailure( |
base::Value(language)); |
} |
-base::DictionaryValue* LanguageOptionsHandlerCommon::GetUILanguageCodeSet() { |
- base::DictionaryValue* dictionary = new base::DictionaryValue(); |
+std::unique_ptr<base::DictionaryValue> |
+LanguageOptionsHandlerCommon::GetUILanguageCodeSet() { |
+ auto dictionary = base::MakeUnique<base::DictionaryValue>(); |
const std::vector<std::string>& available_locales = |
l10n_util::GetAvailableLocales(); |
for (size_t i = 0; i < available_locales.size(); ++i) |
@@ -192,9 +195,9 @@ base::DictionaryValue* LanguageOptionsHandlerCommon::GetUILanguageCodeSet() { |
return dictionary; |
} |
-base::DictionaryValue* |
+std::unique_ptr<base::DictionaryValue> |
LanguageOptionsHandlerCommon::GetSpellCheckLanguageCodeSet() { |
- base::DictionaryValue* dictionary = new base::DictionaryValue(); |
+ auto dictionary = base::MakeUnique<base::DictionaryValue>(); |
std::vector<std::string> spell_check_languages; |
spellcheck::SpellCheckLanguages(&spell_check_languages); |
for (size_t i = 0; i < spell_check_languages.size(); ++i) { |