0

Reland "WebUI: Delete SetupBundledWebUIDataSource()"

This reverts commit f15a4115c5.

Reason for revert: Relanded the reverted CL that caused this
CL to be reverted, because that CL was not the reason for build
failure, and the failure has been fixed separately (see
https://bugs.chromium.org/p/chromium/issues/detail?id=1143476)

Original change's description:
> Revert "WebUI: Delete SetupBundledWebUIDataSource()"
>
> This reverts commit f99198c064.
>
> Reason for revert: Compile errors due the removal of this function after having reverted https://chromium-review.googlesource.com/q/commit:85415a2c689f29c97626748a688b58c56cc22f16. See crbug.com/1143504.
>
> Original change's description:
> > WebUI: Delete SetupBundledWebUIDataSource()
> >
> > With the update of OS settings to generate_grd, this method is no
> > longer used.
> >
> > Bug: 1132403
> > Change-Id: Id06f6249b05bebcc72eb22b417d0334bc4d5a708
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505936
> > Reviewed-by: dpapad <dpapad@chromium.org>
> > Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#821828}
>
> TBR=dpapad@chromium.org,rbpotter@chromium.org
>
> Change-Id: I308bddd010b80241e99d731a0bfa0989ad655d73
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 1132403, 1143504
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505359
> Reviewed-by: Patti <patricialor@chromium.org>
> Commit-Queue: Patti <patricialor@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#822006}

TBR=dpapad@chromium.org,patricialor@chromium.org,rbpotter@chromium.org

# Not skipping CQ checks because this is a reland.

Bug: 1132403
Bug: 1143504
Change-Id: I4fcd843a6988d29f74f8e5dae4f9c71417dded62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2508180
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822369}
This commit is contained in:
Rebekah Potter
2020-10-29 21:30:35 +00:00
committed by Commit Bot
parent 17a67c6d3c
commit 5691cab747
3 changed files with 6 additions and 34 deletions

@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/webui_util.h"
#include "build/build_config.h"
#include "chrome/common/buildflags.h"
#include "content/public/browser/web_ui_data_source.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/webui/web_ui_util.h"
@ -57,17 +56,6 @@ void SetupWebUIDataSource(content::WebUIDataSource* source,
source->AddResourcePath("", default_resource);
}
#if BUILDFLAG(OPTIMIZE_WEBUI)
void SetupBundledWebUIDataSource(content::WebUIDataSource* source,
base::StringPiece bundled_path,
int bundle,
int default_resource) {
SetupPolymer3Defaults(source);
source->AddResourcePath(bundled_path, bundle);
source->AddResourcePath("", default_resource);
}
#endif
void AddLocalizedStringsBulk(content::WebUIDataSource* html_source,
base::span<const LocalizedString> strings) {
for (const auto& str : strings)

@ -9,7 +9,6 @@
#include "base/containers/span.h"
#include "base/strings/string_piece.h"
#include "chrome/common/buildflags.h"
struct GritResourceMap;
@ -35,15 +34,6 @@ void SetupWebUIDataSource(content::WebUIDataSource* source,
const std::string& generated_path,
int default_resource);
#if BUILDFLAG(OPTIMIZE_WEBUI)
// Same as SetupWebUIDataSource, but for a bundled page; this adds only the
// bundle and the default resource to |source|.
void SetupBundledWebUIDataSource(content::WebUIDataSource* source,
base::StringPiece bundled_path,
int bundle,
int default_resource);
#endif
// Calls content::WebUIDataSource::AddLocalizedString() in a for-loop for
// |strings|. Reduces code size vs. reimplementing the same for-loop.
void AddLocalizedStringsBulk(content::WebUIDataSource* html_source,

@ -407,12 +407,12 @@ resource map can be added as follows:
```
<a name="SetupWebUIDataSource"></a>
### webui::SetupWebUIDataSource() and webui::SetupBundledWebUIDataSource()
### webui::SetupWebUIDataSource()
These methods perform common configuration tasks on a data source for a Web UI
that uses JS modules. When creating a Web UI that uses JS modules, use these
utilities instead of duplicating the configuration steps they perform elsewhere.
Specific setup steps performed by these utilities include:
This method performs common configuration tasks on a data source for a Web UI
that uses JS modules. When creating a Web UI that uses JS modules, use this
utility instead of duplicating the configuration steps it performs elsewhere.
Specific setup steps include:
* Setting the content security policy to allow the data source to load only
resources from its own host (e.g. chrome://history), chrome://resources, and
@ -422,13 +422,7 @@ Specific setup steps performed by these utilities include:
* Adding the test loader files to the data source, so that test files can be
loaded as JS modules.
* Setting the resource to load for the empty path.
The version for non-bundled UIs (<code>SetupWebUIDataSource()</code>) also adds
all resources in a GritResourceMap.
The version for bundled UIs (<code>SetupBundledWebUIDataSource()</code>) adds
a single specified bundled resource. Note that this version is only defined when
the optimize_webui build flag is enabled.
* Adding all resources from a GritResourceMap.
## Browser (C++) &rarr; Renderer (JS)