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

Unified Diff: ui/base/template_expressions.cc

Issue 2607843002: [MD settings] i18n template replacements in shared HTML resources (Closed)
Patch Set: nits Created 3 years, 11 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
« no previous file with comments | « ui/base/template_expressions.h ('k') | ui/base/webui/jstemplate_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/template_expressions.cc
diff --git a/ui/base/template_expressions.cc b/ui/base/template_expressions.cc
index 10aaf4fecf5a4e44040c427de461ba5704336fbf..b8867d8cfaa1bdf2f3d5d42935063284235164d9 100644
--- a/ui/base/template_expressions.cc
+++ b/ui/base/template_expressions.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/logging.h"
+#include "base/values.h"
#include "net/base/escape.h"
namespace {
@@ -18,6 +19,19 @@ const char kKeyClose = '}';
namespace ui {
+void TemplateReplacementsFromDictionaryValue(
+ const base::DictionaryValue& dictionary,
+ TemplateReplacements* replacements) {
+ for (base::DictionaryValue::Iterator it(dictionary); !it.IsAtEnd();
+ it.Advance()) {
+ if (it.value().IsType(base::Value::Type::STRING)) {
+ std::string str_value;
+ if (it.value().GetAsString(&str_value))
+ (*replacements)[it.key()] = str_value;
+ }
+ }
+}
+
std::string ReplaceTemplateExpressions(
base::StringPiece source,
const TemplateReplacements& replacements) {
« no previous file with comments | « ui/base/template_expressions.h ('k') | ui/base/webui/jstemplate_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698