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

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

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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.cc
diff --git a/chrome/browser/ui/webui/options/language_options_handler.cc b/chrome/browser/ui/webui/options/language_options_handler.cc
index 1d258163b4856a188e7e64c499909fb807c0c1d8..8221f905309ea32aca7a9dbf1c802d5f8d5a7b77 100644
--- a/chrome/browser/ui/webui/options/language_options_handler.cc
+++ b/chrome/browser/ui/webui/options/language_options_handler.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -103,12 +104,13 @@ base::ListValue* LanguageOptionsHandler::GetLanguageList() {
bool has_rtl_chars = base::i18n::StringContainsStrongRTLChars(display_name);
std::string directionality = has_rtl_chars ? "rtl" : "ltr";
- base::DictionaryValue* dictionary = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> dictionary(
+ new base::DictionaryValue());
dictionary->SetString("code", pair.first);
dictionary->SetString("displayName", adjusted_display_name);
dictionary->SetString("textDirection", directionality);
dictionary->SetString("nativeDisplayName", adjusted_native_display_name);
- language_list->Append(dictionary);
+ language_list->Append(std::move(dictionary));
}
return language_list;

Powered by Google App Engine
This is Rietveld 408576698