Commit 0b21c474 authored by dpapad's avatar dpapad Committed by Commit Bot

WebUI: Auto-generate grd file for chrome://quota-internals.

Bug: 1132403
Change-Id: Icf389d0a6dff707bcb17e9e03006f06821d26765
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2497197
Auto-Submit: dpapad <dpapad@chromium.org>
Commit-Queue: John Lee <johntlee@chromium.org>
Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820857}
parent 0bced2c0
......@@ -5,6 +5,19 @@
import("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
generate_grd("build_grd") {
grd_prefix = "quota_internals"
out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
input_files = [
"event_handler.js",
"main.css",
"main.html",
"message_dispatcher.js",
]
input_files_base_dir = rebase_path(".", "//")
}
js_type_check("closure_compile") {
uses_js_modules = true
......@@ -29,10 +42,23 @@ js_library("message_dispatcher") {
}
grit("quota_internals_resources") {
source = "quota_internals_resources.grd"
grit_flags = [
"-E",
"root_src_dir=" + rebase_path("//", root_build_dir),
]
defines = chrome_grit_defines
# These arguments are needed since the grd is generated at build time.
enable_input_discovery_for_gn_analyze = false
defines +=
[ "SHARED_INTERMEDIATE_DIR=" + rebase_path(root_gen_dir, root_build_dir) ]
source = "$target_gen_dir/quota_internals_resources.grd"
deps = [ ":build_grd" ]
outputs = [
"grit/quota_internals_resources.h",
"grit/quota_internals_resources_map.cc",
"grit/quota_internals_resources_map.h",
"quota_internals_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
......
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/quota_internals_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="quota_internals_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_QUOTA_INTERNALS_MAIN_HTML" file="main.html" type="BINDATA"/>
<include name="IDR_QUOTA_INTERNALS_EVENT_HANDLER_JS" file="event_handler.js" type="BINDATA"/>
<include name="IDR_QUOTA_INTERNALS_MESSAGE_DISPATCHER_JS" file="message_dispatcher.js" type="BINDATA"/>
</includes>
</release>
</grit>
......@@ -9,8 +9,10 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/quota_internals/quota_internals_handler.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/quota_internals_resources.h"
#include "chrome/grit/quota_internals_resources_map.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
......@@ -23,13 +25,11 @@ namespace {
content::WebUIDataSource* CreateQuotaInternalsHTMLSource() {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIQuotaInternalsHost);
source->UseStringsJs();
source->AddResourcePath(
"event_handler.js", IDR_QUOTA_INTERNALS_EVENT_HANDLER_JS);
source->AddResourcePath(
"message_dispatcher.js", IDR_QUOTA_INTERNALS_MESSAGE_DISPATCHER_JS);
source->SetDefaultResource(IDR_QUOTA_INTERNALS_MAIN_HTML);
webui::AddResourcePathsBulk(
source,
base::make_span(kQuotaInternalsResources, kQuotaInternalsResourcesSize));
source->AddResourcePath("", IDR_QUOTA_INTERNALS_MAIN_HTML);
source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::TrustedTypes,
"trusted-types cr-ui-tree-js-static;");
......
......@@ -244,7 +244,8 @@
"chrome/browser/resources/omnibox/resources.grd": {
"includes": [2140],
},
"chrome/browser/resources/quota_internals/quota_internals_resources.grd": {
"<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/quota_internals/quota_internals_resources.grd": {
"META": {"sizes": {"includes": [20]}},
"includes": [2160],
},
"chrome/browser/resources/sync_file_system_internals/sync_file_system_internals_resources.grd": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment