Commit f3918a2e authored by dpapad's avatar dpapad Committed by Commit Bot

WebUI TabStrip: Auto-generate grd file.

Bug: 1132403
Change-Id: I690822d909ed5c86bcb1b9c6652bfc9dd61cf3e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2479142
Commit-Queue: John Lee <johntlee@chromium.org>
Auto-Submit: dpapad <dpapad@chromium.org>
Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817997}
parent 2039ca75
......@@ -663,9 +663,23 @@ if (enable_tab_search) {
if (enable_webui_tab_strip) {
grit("tab_strip_resources") {
source = "tab_strip/tab_strip_resources.grd"
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
"-E",
"root_src_dir=" + rebase_path("//", root_build_dir),
]
defines = chrome_grit_defines
deps = [ "tab_strip:web_components" ]
# 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) ]
tab_strip_gen_dir = "$root_gen_dir/chrome/browser/resources/tab_strip"
source = "$tab_strip_gen_dir/tab_strip_resources.grd"
deps = [ "//chrome/browser/resources/tab_strip:build_grd" ]
outputs = [
"grit/tab_strip_resources.h",
"grit/tab_strip_resources_map.cc",
......@@ -673,10 +687,6 @@ if (enable_webui_tab_strip) {
"tab_strip_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
}
}
......
......@@ -3,7 +3,68 @@
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/preprocess_grit.gni")
import("//tools/polymer/html_to_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
preprocess_folder = "preprocessed"
preprocess_manifest = "preprocessed_manifest.json"
preprocess_gen_manifest = "preprocessed_gen_manifest.json"
generate_grd("build_grd") {
grd_prefix = "tab_strip"
out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
input_files = [
"alert_indicators/picture_in_picture_alt.svg",
"alert_indicators/serial_port.svg",
"alert_indicators/tab_audio_muting_rounded.svg",
"alert_indicators/tab_audio_rounded.svg",
"alert_indicators/tab_bluetooth_connected.svg",
"alert_indicators/tab_hid_connected.svg",
"alert_indicators/tab_media_capturing_with_arrow.svg",
"alert_indicators/tab_media_recording.svg",
"alert_indicators/tab_usb_connected.svg",
"alert_indicators/vr_headset.svg",
"tab_strip.html",
]
input_files_base_dir = rebase_path(".", "//")
deps = [
":preprocess",
":preprocess_generated",
]
manifest_files = [
"$target_gen_dir/$preprocess_manifest",
"$target_gen_dir/$preprocess_gen_manifest",
]
}
preprocess_grit("preprocess") {
in_folder = "./"
out_folder = "$target_gen_dir/$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_manifest"
in_files = [
"custom_element.js",
"drag_manager.js",
"tab_strip_embedder_proxy.js",
"tab_swiper.js",
"tabs_api_proxy.js",
]
}
preprocess_grit("preprocess_generated") {
deps = [ ":web_components" ]
in_folder = target_gen_dir
out_folder = "$target_gen_dir/$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_gen_manifest"
in_files = [
"alert_indicator.js",
"alert_indicators.js",
"tab_group.js",
"tab_list.js",
"tab.js",
]
}
js_type_check("closure_compile") {
uses_js_modules = true
......
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/tab_strip_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/tab_strip_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/tab_strip_resources_map.h"
type="resource_map_header" />
<output filename="tab_strip_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<structures>
<structure
name="IDR_TAB_STRIP_HTML"
file="tab_strip.html"
type="chrome_html"
preprocess="true"/>
<structure
name="IDR_TAB_STRIP_TABS_API_PROXY_JS"
file="tabs_api_proxy.js"
type="chrome_html"/>
<structure
name="IDR_TAB_STRIP_CUSTOM_ELEMENT_JS"
file="custom_element.js"
type="chrome_html"/>
<structure
name="IDR_TAB_STRIP_TAB_GROUP_JS"
file="${root_gen_dir}/chrome/browser/resources/tab_strip/tab_group.js"
use_base_dir="false"
type="chrome_html"/>
<structure
name="IDR_TAB_STRIP_TAB_LIST_JS"
file="${root_gen_dir}/chrome/browser/resources/tab_strip/tab_list.js"
use_base_dir="false"
type="chrome_html"
preprocess="true"/>
<structure
name="IDR_TAB_STRIP_TAB_JS"
file="${root_gen_dir}/chrome/browser/resources/tab_strip/tab.js"
use_base_dir="false"
type="chrome_html"/>
<structure
name="IDR_TAB_STRIP_ALERT_INDICATOR_JS"
file="${root_gen_dir}/chrome/browser/resources/tab_strip/alert_indicator.js"
use_base_dir="false"
type="chrome_html"/>
<structure
name="IDR_TAB_STRIP_ALERT_INDICATORS_JS"
file="${root_gen_dir}/chrome/browser/resources/tab_strip/alert_indicators.js"
use_base_dir="false"
type="chrome_html"/>
<structure
name="IDR_TAB_STRIP_EMBEDDER_PROXY_JS"
file="tab_strip_embedder_proxy.js"
type="chrome_html"/>
<structure
name="IDR_TAB_STRIP_TAB_SWIPER_JS"
file="tab_swiper.js"
type="chrome_html"/>
<structure
name="IDR_TAB_STRIP_DRAG_MANAGER_JS"
file="drag_manager.js"
type="chrome_html"
preprocess="true"/>
</structures>
<includes>
<!-- Alert indicators -->
<include
name="IDR_TAB_STRIP_PICTURE_IN_PICTURE_ALT_SVG"
file="alert_indicators/picture_in_picture_alt.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_SERIAL_PORT_SVG"
file="alert_indicators/serial_port.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_TAB_AUDIO_MUTING_ROUNDED_SVG"
file="alert_indicators/tab_audio_muting_rounded.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_TAB_AUDIO_ROUNDED_SVG"
file="alert_indicators/tab_audio_rounded.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_TAB_BLUETOOTH_CONNECTED_SVG"
file="alert_indicators/tab_bluetooth_connected.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_TAB_HID_CONNECTED_SVG"
file="alert_indicators/tab_hid_connected.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_TAB_MEDIA_CAPTURING_WITH_ARROW_SVG"
file="alert_indicators/tab_media_capturing_with_arrow.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_TAB_MEDIA_RECORING_SVG"
file="alert_indicators/tab_media_recording.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_TAB_USB_CONNECTED_SVG"
file="alert_indicators/tab_usb_connected.svg"
type="BINDATA" />
<include
name="IDR_TAB_STRIP_VR_HEADSET_SVG"
file="alert_indicators/vr_headset.svg"
type="BINDATA" />
</includes>
</release>
</grit>
......@@ -45,11 +45,9 @@ TabStripUI::TabStripUI(content::WebUI* web_ui)
Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUITabStripHost);
std::string generated_path =
"@out_folder@/gen/chrome/browser/resources/tab_strip/";
webui::SetupWebUIDataSource(
html_source, base::make_span(kTabStripResources, kTabStripResourcesSize),
generated_path, IDR_TAB_STRIP_HTML);
"", IDR_TAB_STRIP_TAB_STRIP_HTML);
html_source->AddString("tabIdDataType", kWebUITabIdDataType);
html_source->AddString("tabGroupIdDataType", kWebUITabGroupIdDataType);
......
......@@ -188,8 +188,8 @@
"chrome/browser/resources/tab_search/tab_search_resources.grd": {
"includes": [1880],
},
"chrome/browser/resources/tab_strip/tab_strip_resources.grd": {
"structures": [1900],
"<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/tab_strip/tab_strip_resources.grd": {
"META": {"sizes": {"includes": [20]}},
"includes": [1920],
},
"<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/welcome/welcome_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