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

Unified Diff: chrome/browser/ui/webui/chromeos/login/l10n_util.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/chromeos/login/l10n_util.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
index 41389aa027ee5175e78e0faf1a99030303a8e0f4..e6fe8c950ed8d13969318280c4b249e710fc4363 100644
--- a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
+++ b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
@@ -8,6 +8,7 @@
#include <iterator>
#include <map>
+#include <memory>
#include <set>
#include <utility>
@@ -15,6 +16,7 @@
#include "base/i18n/rtl.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
#include "base/stl_util.h"
@@ -71,7 +73,7 @@ void AddOptgroupOtherLayouts(base::ListValue* input_methods_list) {
optgroup->SetString(
"optionGroupName",
l10n_util::GetStringUTF16(IDS_OOBE_OTHER_KEYBOARD_LAYOUTS));
- input_methods_list->Append(optgroup.release());
+ input_methods_list->Append(std::move(optgroup));
}
base::DictionaryValue* CreateLanguageEntry(
@@ -267,9 +269,9 @@ std::unique_ptr<base::ListValue> GetLanguageList(
base::string16 display_name(out_display_names[i]);
if (insert_divider && display_name == divider16) {
// Insert divider.
- base::DictionaryValue* dictionary = new base::DictionaryValue();
+ auto dictionary = base::MakeUnique<base::DictionaryValue>();
dictionary->SetString("code", kMostRelevantLanguagesDivider);
- language_list->Append(dictionary);
+ language_list->Append(std::move(dictionary));
continue;
}
@@ -322,8 +324,7 @@ void GetKeyboardLayoutsForResolvedLocale(
util->GetInputMethodDescriptorFromId(*it);
if (!InsertString(ime->id(), &input_methods_added))
continue;
- input_methods_list->Append(
- CreateInputMethodsEntry(*ime, selected).release());
+ input_methods_list->Append(CreateInputMethodsEntry(*ime, selected));
}
callback.Run(std::move(input_methods_list));
@@ -535,8 +536,7 @@ std::unique_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts(
// Do not crash in case of misconfiguration.
if (ime) {
input_methods_added.insert(*i);
- input_methods_list->Append(
- CreateInputMethodsEntry(*ime, selected).release());
+ input_methods_list->Append(CreateInputMethodsEntry(*ime, selected));
} else {
NOTREACHED();
}
@@ -552,8 +552,8 @@ std::unique_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts(
optgroup_added = true;
AddOptgroupOtherLayouts(input_methods_list.get());
}
- input_methods_list->Append(CreateInputMethodsEntry((*input_methods)[i],
- selected).release());
+ input_methods_list->Append(
+ CreateInputMethodsEntry((*input_methods)[i], selected));
}
// "xkb:us::eng" should always be in the list of available layouts.
@@ -567,8 +567,8 @@ std::unique_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts(
optgroup_added = true;
AddOptgroupOtherLayouts(input_methods_list.get());
}
- input_methods_list->Append(CreateInputMethodsEntry(*us_eng_descriptor,
- selected).release());
+ input_methods_list->Append(
+ CreateInputMethodsEntry(*us_eng_descriptor, selected));
manager->GetActiveIMEState()->EnableInputMethod(us_keyboard_id);
}
return input_methods_list;

Powered by Google App Engine
This is Rietveld 408576698