WebUI NTP: fix template replacement DCHECK
The DCHECK is ensuring that placeholders like $1 are not in the
replacement string. This check does not pertain to the HTML/CSS/JS that
is being replaced from external sources. This CL adds a parameter to
allow skipping this DCHECK.
Bug: 1064396
Change-Id: Icba04d7080de5805a69ff7deb8a8f5cc7b49a293
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2159786
Reviewed-by: dpapad <[email protected]>
Commit-Queue: Esmael Elmoslimany <[email protected]>
Cr-Commit-Position: refs/heads/master@{#761239}
diff --git a/ui/base/template_expressions.h b/ui/base/template_expressions.h
index a2768258..a12f5b2 100644
--- a/ui/base/template_expressions.h
+++ b/ui/base/template_expressions.h
@@ -35,7 +35,8 @@
// be unaltered.
UI_BASE_EXPORT std::string ReplaceTemplateExpressions(
base::StringPiece source,
- const TemplateReplacements& replacements);
+ const TemplateReplacements& replacements,
+ bool skip_unexpected_placeholder_check = false);
// Replace $i18n*{foo} in the HTML template contained in |source| with the
// value for the foo key in |replacements| and return the result in |output|.