Commit af86afd9 authored by Samuel Huang's avatar Samuel Huang Committed by Commit Bot

[DevUI DFM] Move chrome://usb-internals to the DFM.

This CL also serves as a self-contained "vertical" example for how to
move a WebUI page to the DevUI DFM.

Bug: 927131
Change-Id: I88c5f624d2094ecfd1cf1919d9cb4abe8d1daea4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1823605Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700415}
parent 51da4f94
...@@ -19,7 +19,8 @@ namespace { ...@@ -19,7 +19,8 @@ namespace {
// Decides whether WebUI |host| (assumed for chrome://) is in the DevUI DFM. // Decides whether WebUI |host| (assumed for chrome://) is in the DevUI DFM.
bool IsWebUiHostInDevUiDfm(const std::string& host) { bool IsWebUiHostInDevUiDfm(const std::string& host) {
// Each WebUI host in the DevUI DFM must have an entry here. // Each WebUI host in the DevUI DFM must have an entry here.
return host == kChromeUIBluetoothInternalsHost; return host == kChromeUIBluetoothInternalsHost ||
host == kChromeUIUsbInternalsHost;
} }
} // namespace } // namespace
......
...@@ -351,12 +351,6 @@ ...@@ -351,12 +351,6 @@
<include name="IDR_USB_DEVICE_MANAGER_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_manager.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" /> <include name="IDR_USB_DEVICE_MANAGER_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_manager.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_USB_DEVICE_MANAGER_TEST_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_manager_test.mojom-lite.js" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" /> <include name="IDR_USB_DEVICE_MANAGER_TEST_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_manager_test.mojom-lite.js" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_USB_DEVICE_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_device.mojom-lite.js" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" /> <include name="IDR_USB_DEVICE_MOJOM_LITE_JS" file="${root_gen_dir}\services\device\public\mojom\usb_device.mojom-lite.js" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_CSS" file="resources\usb_internals\usb_internals.css" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_DESCRIPTOR_PANEL_JS" file="resources\usb_internals\descriptor_panel.js" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_DEVICES_PAGE_JS" file="resources\usb_internals\devices_page.js" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_HTML" file="resources\usb_internals\usb_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_JS" file="resources\usb_internals\usb_internals.js" type="BINDATA" compress="gzip" />
<include name="IDR_USB_INTERNALS_MOJOM_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\usb_internals\usb_internals.mojom-lite.js" use_base_dir="false" type="BINDATA" compress="gzip" />
<include name="IDR_WEB_FOOTER_EXPERIMENT_HTML" file="resources\web_footer_experiment\index.html" type="BINDATA" /> <include name="IDR_WEB_FOOTER_EXPERIMENT_HTML" file="resources\web_footer_experiment\index.html" type="BINDATA" />
<include name="IDR_WEBRTC_LOGS_HTML" file="resources\media\webrtc_logs.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> <include name="IDR_WEBRTC_LOGS_HTML" file="resources\media\webrtc_logs.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_WEBRTC_LOGS_JS" file="resources\media\webrtc_logs.js" type="BINDATA" /> <include name="IDR_WEBRTC_LOGS_JS" file="resources\media\webrtc_logs.js" type="BINDATA" />
......
...@@ -359,8 +359,10 @@ repack("dev_ui_paks") { ...@@ -359,8 +359,10 @@ repack("dev_ui_paks") {
sources = [ sources = [
"$root_gen_dir/chrome/bluetooth_internals_resources.pak", "$root_gen_dir/chrome/bluetooth_internals_resources.pak",
"$root_gen_dir/chrome/usb_internals_resources.pak",
] ]
deps = [ deps = [
"//chrome/browser/resources/bluetooth_internals:resources", "//chrome/browser/resources/bluetooth_internals:resources",
"//chrome/browser/resources/usb_internals:resources",
] ]
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
js_type_check("closure_compile") { js_type_check("closure_compile") {
deps = [ deps = [
...@@ -37,3 +38,23 @@ js_library("descriptor_panel") { ...@@ -37,3 +38,23 @@ js_library("descriptor_panel") {
"//ui/webui/resources/js:cr", "//ui/webui/resources/js:cr",
] ]
} }
grit("resources") {
source = "resources.grd"
# The .grd contains references to generated files.
source_is_generated = true
outputs = [
"grit/usb_internals_resources.h",
"usb_internals_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
depfile_dir = target_gen_dir
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
"//chrome/browser/ui/webui/usb_internals:mojo_bindings_js",
]
}
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0"
current_release="1"
output_all_resource_defines="false">
<outputs>
<output filename="grit/usb_internals_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="usb_internals_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_USB_INTERNALS_CSS"
file="usb_internals.css"
type="BINDATA"
compress="gzip" />
<include name="IDR_USB_INTERNALS_DESCRIPTOR_PANEL_JS"
file="descriptor_panel.js"
type="BINDATA"
compress="gzip" />
<include name="IDR_USB_INTERNALS_DEVICES_PAGE_JS"
file="devices_page.js"
type="BINDATA"
compress="gzip" />
<include name="IDR_USB_INTERNALS_HTML"
file="usb_internals.html"
flattenhtml="true"
allowexternalscript="true"
type="BINDATA"
compress="gzip" />
<include name="IDR_USB_INTERNALS_JS"
file="usb_internals.js"
type="BINDATA"
compress="gzip" />
<include name="IDR_USB_INTERNALS_MOJOM_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\usb_internals\usb_internals.mojom-lite.js"
use_base_dir="false"
type="BINDATA"
compress="gzip" />
</includes>
</release>
</grit>
...@@ -401,6 +401,7 @@ jumbo_split_static_library("ui") { ...@@ -401,6 +401,7 @@ jumbo_split_static_library("ui") {
"//chrome/browser/media:mojo_bindings", "//chrome/browser/media:mojo_bindings",
"//chrome/browser/notifications/scheduler/public", "//chrome/browser/notifications/scheduler/public",
"//chrome/browser/profiling_host", "//chrome/browser/profiling_host",
"//chrome/browser/resources/usb_internals:resources",
"//chrome/browser/safe_browsing", "//chrome/browser/safe_browsing",
"//chrome/browser/ssl:proto", "//chrome/browser/ssl:proto",
"//chrome/browser/ui/webui/bluetooth_internals", "//chrome/browser/ui/webui/bluetooth_internals",
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/browser/ui/webui/usb_internals/usb_internals_page_handler.h" #include "chrome/browser/ui/webui/usb_internals/usb_internals_page_handler.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "chrome/grit/usb_internals_resources.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
UsbInternalsUI::UsbInternalsUI(content::WebUI* web_ui) UsbInternalsUI::UsbInternalsUI(content::WebUI* web_ui)
......
...@@ -153,15 +153,18 @@ ...@@ -153,15 +153,18 @@
"structures": [13880], "structures": [13880],
"includes": [13900], "includes": [13900],
}, },
"chrome/browser/resources/webapks/webapks_ui_resources.grd": { "chrome/browser/resources/usb_internals/resources.grd": {
"includes": [13910], "includes": [13910],
}, },
"chrome/browser/resources/welcome/welcome_resources.grd": { "chrome/browser/resources/webapks/webapks_ui_resources.grd": {
"includes": [13920], "includes": [13920],
"structures": [13970], },
"chrome/browser/resources/welcome/welcome_resources.grd": {
"includes": [13930],
"structures": [13980],
}, },
"chrome/browser/vr/testapp/vr_testapp_resources.grd": { "chrome/browser/vr/testapp/vr_testapp_resources.grd": {
"includes": [14010], "includes": [14020],
}, },
# END chrome/browser section. # END chrome/browser section.
......
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