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

Unified Diff: chrome/browser/ui/webui/options/language_options_handler_common.cc

Issue 2812953002: Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: No ListValue::SetDouble 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/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) {

Powered by Google App Engine
This is Rietveld 408576698