Commit ccfafbd8 authored by dpapad's avatar dpapad Committed by Chromium LUCI CQ

WebUI: Auto-generate grd file for chrome://syncfs-internals

In the process, removed flattenhtml=true to stop inlining
main.css, and serving it from its own URL instead. Similarly for
other <include> flags in main.html.

Bug: 1132403,1152343
Change-Id: I6c367dd5361111124db4d2592fac67582c7db740
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2629108
Auto-Submit: dpapad <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843944}
parent 10778c6f
......@@ -63,8 +63,8 @@ group("resources") {
if (enable_extensions) {
public_deps += [
":sync_file_system_internals_resources",
"extensions:extensions_resources",
"sync_file_system_internals:resources",
]
}
......@@ -243,19 +243,6 @@ if (is_chromeos_ash) {
}
}
if (enable_extensions) {
grit("sync_file_system_internals_resources") {
source =
"sync_file_system_internals/sync_file_system_internals_resources.grd"
defines = chrome_grit_defines
outputs = [
"grit/sync_file_system_internals_resources.h",
"sync_file_system_internals_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
}
repack("dev_ui_paks") {
output = "$root_gen_dir/chrome/dev_ui_resources.pak"
......
......@@ -2,7 +2,56 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//chrome/common/features.gni")
import("//extensions/buildflags/buildflags.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/preprocess_if_expr.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
assert(enable_extensions, "enable extensions check failed")
preprocess_manifest = "preprocessed_manifest.json"
grit("resources") {
defines = chrome_grit_defines
enable_input_discovery_for_gn_analyze = false
source = "$target_gen_dir/resources.grd"
deps = [ ":build_grd" ]
outputs = [
"grit/sync_file_system_internals_resources.h",
"grit/sync_file_system_internals_resources_map.h",
"grit/sync_file_system_internals_resources_map.cc",
"sync_file_system_internals_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
generate_grd("build_grd") {
grd_prefix = "sync_file_system_internals"
out_grd = "$target_gen_dir/resources.grd"
input_files = [
"dump_database.js",
"extension_statuses.js",
"file_metadata.js",
"main.html",
"sync_service.js",
"task_log.js",
"utils.js",
]
input_files_base_dir = rebase_path(".", "//")
manifest_files = [ "$target_gen_dir/$preprocess_manifest" ]
deps = [ ":preprocess" ]
}
preprocess_if_expr("preprocess") {
in_folder = "./"
out_folder = "$target_gen_dir/preprocessed"
out_manifest = "$target_gen_dir/$preprocess_manifest"
in_files = [ "main.css" ]
}
js_type_check("closure_compile") {
uses_js_modules = true
......
<button id="refresh-database-dump">Refresh</button>
<div id="dump-database-placeholder"></div>
<button id="refresh-extensions-statuses">Refresh</button>
<table>
<thead>
<tr>
<td>Extension Name</td>
<td>ID</td>
<td>Sync Status</td>
</tr>
</thead>
<tbody id="extension-entries"></tbody>
</table>
<select id="extensions-select"></select>
<button id="refresh-metadata-button">Refresh</button>
<table style="table-layout:fixed">
<thead id="file-metadata-header"></thead>
<tbody id="file-metadata-entries"></tbody>
</table>
......@@ -27,19 +27,71 @@ found in the LICENSE file.
</tabs>
<tabpanels>
<tabpanel>
<include src="sync_service.html" >
<table>
<tbody>
<tr>
<td>Service Status</td>
<td id="service-status">N/A</td>
</tr>
<tr>
<td>Notification Source</td>
<td id="notification-source">N/A</td>
</tr>
</tbody>
</table>
<br>
<button id="clear-log-button">Clear old logs</button>
<h3>Debug Log</h3>
<table>
<thead>
<tr>
<td class="log-time">Time</td>
<td class="log-event">Log Event</td>
</tr>
</thead>
<tbody id="log-entries"></tbody>
</table>
</tabpanel>
<tabpanel>
<include src="task_log.html" >
<h3>Task Log</h3>
<table>
<thead>
<tr>
<td>Duration</td>
<td>Task</td>
<td>Result</td>
<td>Details</td>
</tr>
</thead>
<tbody id="task-log-entries"></tbody>
</table>
</tabpanel>
<tabpanel>
<include src="extension_statuses.html" >
<button id="refresh-extensions-statuses">Refresh</button>
<table>
<thead>
<tr>
<td>Extension Name</td>
<td>ID</td>
<td>Sync Status</td>
</tr>
</thead>
<tbody id="extension-entries"></tbody>
</table>
</tabpanel>
<tabpanel>
<include src="file_metadata.html" >
<select id="extensions-select"></select>
<button id="refresh-metadata-button">Refresh</button>
<table style="table-layout:fixed">
<thead id="file-metadata-header"></thead>
<tbody id="file-metadata-entries"></tbody>
</table>
</tabpanel>
<tabpanel>
<include src="dump_database.html" >
<button id="refresh-database-dump">Refresh</button>
<div id="dump-database-placeholder"></div>
</tabpanel>
</tabpanels>
</tabbox>
......
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/sync_file_system_internals_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="sync_file_system_internals_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_SYNC_FILE_SYSTEM_INTERNALS_UTILS_JS" file="utils.js" type="BINDATA" />
<include name="IDR_SYNC_FILE_SYSTEM_INTERNALS_EXTENSION_STATUSES_JS" file="extension_statuses.js" type="BINDATA" />
<include name="IDR_SYNC_FILE_SYSTEM_INTERNALS_FILE_METADATA_JS" file="file_metadata.js" type="BINDATA" />
<include name="IDR_SYNC_FILE_SYSTEM_INTERNALS_DUMP_DATABASE_JS" file="dump_database.js" type="BINDATA" />
<include name="IDR_SYNC_FILE_SYSTEM_INTERNALS_MAIN_HTML" file="main.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_SYNC_FILE_SYSTEM_INTERNALS_SYNC_SERVICE_JS" file="sync_service.js" type="BINDATA" />
<include name="IDR_SYNC_FILE_SYSTEM_INTERNALS_TASK_LOG_JS" file="task_log.js" type="BINDATA" />
</includes>
</release>
</grit>
<table>
<tbody>
<tr>
<td>Service Status</td>
<td id="service-status">N/A</td>
</tr>
<tr>
<td>Notification Source</td>
<td id="notification-source">N/A</td>
</tr>
</tbody>
</table>
<br>
<button id="clear-log-button">Clear old logs</button>
<h3>Debug Log</h3>
<table>
<thead>
<tr>
<td class="log-time">Time</td>
<td class="log-event">Log Event</td>
</tr>
</thead>
<tbody id="log-entries"></tbody>
</table>
<h3>Task Log</h3>
<table>
<thead>
<tr>
<td>Duration</td>
<td>Task</td>
<td>Result</td>
<td>Details</td>
</tr>
</thead>
<tbody id="task-log-entries"></tbody>
</table>
......@@ -11,8 +11,10 @@
#include "chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.h"
#include "chrome/browser/ui/webui/sync_file_system_internals/file_metadata_handler.h"
#include "chrome/browser/ui/webui/sync_file_system_internals/sync_file_system_internals_handler.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/sync_file_system_internals_resources.h"
#include "chrome/grit/sync_file_system_internals_resources_map.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
......@@ -23,20 +25,9 @@ content::WebUIDataSource* CreateSyncFileSystemInternalsHTMLSource() {
content::WebUIDataSource::Create(
chrome::kChromeUISyncFileSystemInternalsHost);
source->UseStringsJs();
source->AddResourcePath(
"utils.js",
IDR_SYNC_FILE_SYSTEM_INTERNALS_UTILS_JS);
source->AddResourcePath(
"extension_statuses.js",
IDR_SYNC_FILE_SYSTEM_INTERNALS_EXTENSION_STATUSES_JS);
source->AddResourcePath(
"file_metadata.js", IDR_SYNC_FILE_SYSTEM_INTERNALS_FILE_METADATA_JS);
source->AddResourcePath(
"sync_service.js", IDR_SYNC_FILE_SYSTEM_INTERNALS_SYNC_SERVICE_JS);
source->AddResourcePath(
"task_log.js", IDR_SYNC_FILE_SYSTEM_INTERNALS_TASK_LOG_JS);
source->AddResourcePath(
"dump_database.js", IDR_SYNC_FILE_SYSTEM_INTERNALS_DUMP_DATABASE_JS);
webui::AddResourcePathsBulk(
source, base::make_span(kSyncFileSystemInternalsResources,
kSyncFileSystemInternalsResourcesSize));
source->SetDefaultResource(IDR_SYNC_FILE_SYSTEM_INTERNALS_MAIN_HTML);
return source;
}
......
......@@ -263,8 +263,8 @@ template("chrome_extra_paks") {
"$root_gen_dir/extensions/extensions_resources.pak",
]
deps += [
"//chrome/browser/resources:sync_file_system_internals_resources",
"//chrome/browser/resources/extensions:extensions_resources",
"//chrome/browser/resources/sync_file_system_internals:resources",
"//extensions:extensions_resources",
]
}
......
......@@ -261,7 +261,8 @@
"META": {"sizes": {"includes": [20]}},
"includes": [2160],
},
"chrome/browser/resources/sync_file_system_internals/sync_file_system_internals_resources.grd": {
"<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/sync_file_system_internals/resources.grd": {
"META": {"sizes": {"includes": [20]}},
"includes": [2180],
},
"<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/usb_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