Move webui::AddLocalizedStringsBulk to content::WebUIDataSource.
Previously it was implemented as a helper function in webui_util.cc,
but it better belongs in WebUIDataSource as an instance method.
With this change, several calls like
webui::AddLocalizedStringsBulk(source, kLocalizedStrings);
are converted to
source->AddLocalizedStrings(kLocalizedStrings);
A concrete benefit of moving this method in WebUIDataSource is that
it now can be leveraged by more places in the code (for example
chromeos/components/), which do not have permission to depend on
chrome/.
This is in preparation of moving more webui_util.cc helpers
into WebUIDataSource (for similar reasons), and eventually possibly
converting SharedResourcesDataSource to a WebUIDataSource as well.
Bug: 1176299
Change-Id: I03bc46fcc106948857d0a0638609b5e6b5eb87e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2684214
Commit-Queue: Avi Drissman <[email protected]>
Auto-Submit: dpapad <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Rebekah Potter <[email protected]>
Cr-Commit-Position: refs/heads/master@{#852357}
diff --git a/docs/webui_explainer.md b/docs/webui_explainer.md
index 3b84308..df98e41 100644
--- a/docs/webui_explainer.md
+++ b/docs/webui_explainer.md
@@ -361,11 +361,11 @@
common configuration tasks.
<a name="AddLocalizedStringsBulk"></a>
-### webui::AddLocalizedStringsBulk()
+### WebUIDataSource::AddLocalizedStrings()
Many Web UI data sources need to be set up with a large number of localized
strings. Instead of repeatedly calling <code>AddLocalizedString()</code>, create
-an array of all the strings and use <code>AddLocalizedStringsBulk()</code>:
+an array of all the strings and use <code>AddLocalizedStrings()</code>:
```c++
static constexpr webui::LocalizedString kStrings[] = {
@@ -374,7 +374,7 @@
{"ariaRoleDescription", IDS_HISTORY_ARIA_ROLE_DESCRIPTION},
{"bookmarked", IDS_HISTORY_ENTRY_BOOKMARKED},
};
- AddLocalizedStringsBulk(source, kStrings);
+ source->AddLocalizedStrings(kStrings);
```
<a name="AddResourcePathsBulk"></a>