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

Unified Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 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/chromeos/cros_language_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
index fe9b813a60a63bfdecf2c2f5e1956c60d87868b2..0b44f9edde5f134a395f05b251eb844c762bd9bf 100644
--- a/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.cc
@@ -6,8 +6,12 @@
#include <stddef.h>
+#include <memory>
+#include <utility>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -145,7 +149,7 @@ base::ListValue* CrosLanguageOptionsHandler::GetInputMethodList() {
const std::string display_name =
manager->GetInputMethodUtil()->GetInputMethodDisplayNameFromId(
descriptor.id());
- base::DictionaryValue* dictionary = new base::DictionaryValue();
+ auto dictionary = base::MakeUnique<base::DictionaryValue>();
dictionary->SetString("id", descriptor.id());
dictionary->SetString("displayName", display_name);
@@ -157,7 +161,7 @@ base::ListValue* CrosLanguageOptionsHandler::GetInputMethodList() {
}
dictionary->Set("languageCodeSet", languages);
- input_method_list->Append(dictionary);
+ input_method_list->Append(std::move(dictionary));
}
return input_method_list;
@@ -182,7 +186,7 @@ base::ListValue*
for (size_t i = 0; i < descriptor.language_codes().size(); ++i)
language_codes->SetBoolean(descriptor.language_codes().at(i), true);
dictionary->Set("languageCodeSet", language_codes.release());
- ime_ids_list->Append(dictionary.release());
+ ime_ids_list->Append(std::move(dictionary));
}
return ime_ids_list.release();
}

Powered by Google App Engine
This is Rietveld 408576698