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

Unified Diff: content/browser/webui/web_ui_data_source_impl.cc

Issue 2607843002: [MD settings] i18n template replacements in shared HTML resources (Closed)
Patch Set: added TemplateReplacementsSetBool Created 4 years 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: content/browser/webui/web_ui_data_source_impl.cc
diff --git a/content/browser/webui/web_ui_data_source_impl.cc b/content/browser/webui/web_ui_data_source_impl.cc
index e923236b94696e343d18a0eb596a5afe995f9675..565d19dcc227b1a04bc18f2ebf454fcd7de37c11 100644
--- a/content/browser/webui/web_ui_data_source_impl.cc
+++ b/content/browser/webui/web_ui_data_source_impl.cc
@@ -136,24 +136,13 @@ void WebUIDataSourceImpl::AddLocalizedString(const std::string& name,
void WebUIDataSourceImpl::AddLocalizedStrings(
const base::DictionaryValue& localized_strings) {
localized_strings_.MergeDictionary(&localized_strings);
-
- for (base::DictionaryValue::Iterator it(localized_strings); !it.IsAtEnd();
- it.Advance()) {
- if (it.value().IsType(base::Value::Type::STRING)) {
- std::string value;
- it.value().GetAsString(&value);
- replacements_[it.key()] = value;
- }
- }
+ ui::TemplateReplacementsFromDictionaryValue(localized_strings,
+ &replacements_);
}
void WebUIDataSourceImpl::AddBoolean(const std::string& name, bool value) {
localized_strings_.SetBoolean(name, value);
- // TODO(dschuyler): Change name of |localized_strings_| to |load_time_data_|
- // or similar. These values haven't been found as strings for
- // localization. The boolean values are not added to |replacements_|
- // for the same reason, that they are used as flags, rather than string
- // replacements.
+ ui::TemplateReplacementsSetBool(name, value, &replacements_);
}
void WebUIDataSourceImpl::AddInteger(const std::string& name, int32_t value) {

Powered by Google App Engine
This is Rietveld 408576698