0

Use build_webui for Private Aggregation Internals

Based on similar setup for Attribution Internals.

Change-Id: I77b4777e0c0a0a7cbf823b08487713f792317549
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4133412
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Nan Lin <linnan@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1088910}
This commit is contained in:
Nan Lin
2023-01-04 20:21:25 +00:00
committed by Chromium LUCI CQ
parent afb0819b43
commit 8f92efb707
8 changed files with 38 additions and 55 deletions
chrome
content
tools/gritsettings

@ -100,6 +100,7 @@ template("chrome_extra_paks") {
"$root_gen_dir/chrome/segmentation_internals_resources.pak",
"$root_gen_dir/components/autofill/core/browser/autofill_address_rewriter_resources.pak",
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/content/aggregation_service_internals_resources.pak",
"$root_gen_dir/content/attribution_internals_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/content/indexed_db_resources.pak",
@ -123,6 +124,7 @@ template("chrome_extra_paks") {
"//components/optimization_guide/optimization_guide_internals/resources",
"//components/resources",
"//content:content_resources",
"//content/browser/resources/aggregation_service:resources",
"//content/browser/resources/attribution_reporting:resources",
"//content/browser/resources/indexed_db:resources",
"//content/browser/resources/quota:resources",

@ -117,8 +117,6 @@ grit("dev_ui_content_resources") {
"dev_ui_content_resources.pak",
]
deps = [
"//content/browser/aggregation_service:mojo_bindings_js__generator",
"//content/browser/resources/aggregation_service:build_ts",
"//content/browser/resources/gpu:html_wrapper_files",
"//content/browser/resources/process:build_ts",
"//storage/browser/quota:mojo_bindings_js__generator",

@ -7,8 +7,10 @@
#include <memory>
#include <utility>
#include "base/containers/span.h"
#include "content/browser/aggregation_service/aggregation_service_internals_handler_impl.h"
#include "content/grit/dev_ui_content_resources.h"
#include "content/grit/aggregation_service_internals_resources.h"
#include "content/grit/aggregation_service_internals_resources_map.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
@ -27,19 +29,13 @@ AggregationServiceInternalsUI::AggregationServiceInternalsUI(WebUI* web_ui)
web_ui->GetWebContents()->GetBrowserContext(),
kChromeUIPrivateAggregationInternalsHost);
source->AddResourcePath("aggregation_service_internals.mojom-webui.js",
IDR_AGGREGATION_SERVICE_INTERNALS_MOJOM_JS);
source->AddResourcePath("aggregation_service_internals.js",
IDR_AGGREGATION_SERVICE_INTERNALS_JS);
source->AddResourcePath("aggregation_service_internals_table.js",
IDR_AGGREGATION_SERVICE_INTERNALS_TABLE_JS);
source->AddResourcePath("aggregation_service_internals_table.html.js",
IDR_AGGREGATION_SERVICE_INTERNALS_TABLE_HTML_JS);
source->AddResourcePath("table_model.js",
IDR_AGGREGATION_SERVICE_INTERNALS_TABLE_MODEL_JS);
source->AddResourcePath("aggregation_service_internals.css",
IDR_AGGREGATION_SERVICE_INTERNALS_CSS);
source->SetDefaultResource(IDR_AGGREGATION_SERVICE_INTERNALS_HTML);
source->AddResourcePaths(
base::make_span(kAggregationServiceInternalsResources,
kAggregationServiceInternalsResourcesSize));
source->SetDefaultResource(
IDR_AGGREGATION_SERVICE_INTERNALS_AGGREGATION_SERVICE_INTERNALS_HTML);
source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::TrustedTypes,
"trusted-types static-types;");

@ -4,6 +4,7 @@
group("resources") {
public_deps = [
"aggregation_service:resources",
"attribution_reporting:resources",
"indexed_db:resources",
"quota:resources",

@ -2,47 +2,35 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//tools/polymer/html_to_wrapper.gni")
import("//tools/typescript/ts_library.gni")
import("//chrome/browser/resources/tools/build_webui.gni")
html_to_wrapper("html_wrapper_files") {
in_files = [ "aggregation_service_internals_table.html" ]
template = "native"
}
build_webui("build") {
grd_prefix = "aggregation_service_internals"
# Copy (via creating sym links) all the other files into the same folder for
# ts_library.
copy("copy_files") {
deps = [ "//content/browser/aggregation_service:mojo_bindings_js__generator" ]
sources = [
"$root_gen_dir/mojom-webui/content/browser/aggregation_service/aggregation_service_internals.mojom-webui.js",
"aggregation_service_internals.ts",
"aggregation_service_internals_table.ts",
"table_model.ts",
static_files = [
"aggregation_service_internals.html",
"aggregation_service_internals.css",
]
outputs = [ "$target_gen_dir/{{source_file_part}}" ]
}
ts_library("build_ts") {
root_dir = target_gen_dir
out_dir = "$target_gen_dir/tsc"
tsconfig_base = "tsconfig_base.json"
in_files = [
non_web_component_files = [
"aggregation_service_internals.ts",
"aggregation_service_internals_table.ts",
"aggregation_service_internals_table.html.ts",
"table_model.ts",
]
# Generated .js files.
in_files += [ "aggregation_service_internals.mojom-webui.js" ]
deps = [
web_component_files = [ "aggregation_service_internals_table.ts" ]
ts_deps = [
"//ui/webui/resources:library",
"//ui/webui/resources/mojo:library",
]
definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ]
extra_deps = [
":copy_files",
":html_wrapper_files",
]
aggregation_service_content_folder = "content/browser/aggregation_service"
mojo_files = [ "$root_gen_dir/mojom-webui/$aggregation_service_content_folder/aggregation_service_internals.mojom-webui.js" ]
mojo_files_deps =
[ "//$aggregation_service_content_folder:mojo_bindings_js__generator" ]
grit_output_dir = "$root_gen_dir/content"
html_to_wrapper_template = "native"
}

@ -15,13 +15,6 @@ files that belong there instead.
<translations />
<release seq="1">
<includes>
<include name="IDR_AGGREGATION_SERVICE_INTERNALS_HTML" file="browser/resources/aggregation_service/aggregation_service_internals.html" type="BINDATA" />
<include name="IDR_AGGREGATION_SERVICE_INTERNALS_JS" file="${root_gen_dir}/content/browser/resources/aggregation_service/tsc/aggregation_service_internals.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_AGGREGATION_SERVICE_INTERNALS_TABLE_MODEL_JS" file="${root_gen_dir}/content/browser/resources/aggregation_service/tsc/table_model.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_AGGREGATION_SERVICE_INTERNALS_TABLE_JS" file="${root_gen_dir}/content/browser/resources/aggregation_service/tsc/aggregation_service_internals_table.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_AGGREGATION_SERVICE_INTERNALS_TABLE_HTML_JS" file="${root_gen_dir}/content/browser/resources/aggregation_service/tsc/aggregation_service_internals_table.html.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_AGGREGATION_SERVICE_INTERNALS_CSS" file="browser/resources/aggregation_service/aggregation_service_internals.css" type="BINDATA" />
<include name="IDR_AGGREGATION_SERVICE_INTERNALS_MOJOM_JS" file="${root_gen_dir}/mojom-webui/content/browser/aggregation_service/aggregation_service_internals.mojom-webui.js" use_base_dir="false" type="BINDATA" />
<include name="IDR_GPU_BROWSER_BRIDGE_JS" file="browser/resources/gpu/browser_bridge.js" type="BINDATA" />
<include name="IDR_GPU_INTERNALS_HTML" file="browser/resources/gpu/gpu_internals.html" type="BINDATA" />
<include name="IDR_GPU_INTERNALS_JS" file="browser/resources/gpu/gpu_internals.js" type="BINDATA" />

@ -430,6 +430,7 @@ repack("pak") {
sources = [
"$root_gen_dir/base/tracing/protos/tracing_proto_resources.pak",
"$root_gen_dir/content/aggregation_service_internals_resources.pak",
"$root_gen_dir/content/attribution_internals_resources.pak",
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
"$root_gen_dir/content/browser/webrtc/resources/webrtc_internals_resources.pak",

@ -452,6 +452,10 @@
"components/resources/dev_ui_components_resources.grd": {
"includes": [2560],
},
"<(SHARED_INTERMEDIATE_DIR)/content/browser/resources/aggregation_service/resources.grd": {
"META": {"sizes": {"includes": [20]}},
"includes": [2563],
},
"<(SHARED_INTERMEDIATE_DIR)/content/browser/resources/attribution_reporting/resources.grd": {
"META": {"sizes": {"includes": [20]}},
"includes": [2565],