Commit 69c72139 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Reland Downloads Web UI: Add individual grd file

Change downloads to use the same approach as settings, extensions, and
print preview:
(1) Use an individual grd file instead of browser_resources.grd
(2) Create unpak folder

Bug: 715296
Change-Id: Ieff03ab94d867871d62d29e217fc189434e8b03d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1605478Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658696}
parent 39e3841c
...@@ -1646,6 +1646,7 @@ group("extra_resources") { ...@@ -1646,6 +1646,7 @@ group("extra_resources") {
if (!is_android) { if (!is_android) {
public_deps += [ public_deps += [
"//chrome/browser/resources:component_extension_resources", "//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:downloads_resources",
"//chrome/browser/resources:local_ntp_resources", "//chrome/browser/resources:local_ntp_resources",
"//chrome/browser/resources:settings_resources", "//chrome/browser/resources:settings_resources",
] ]
......
...@@ -5075,7 +5075,6 @@ grit("resources") { ...@@ -5075,7 +5075,6 @@ grit("resources") {
"//chrome/browser/performance_manager:mojo_bindings_js", "//chrome/browser/performance_manager:mojo_bindings_js",
"//chrome/browser/resources/ssl/ssl_error_assistant:make_ssl_error_assistant_protobuf", "//chrome/browser/resources/ssl/ssl_error_assistant:make_ssl_error_assistant_protobuf",
"//chrome/browser/ui/webui/bluetooth_internals:mojo_bindings_js", "//chrome/browser/ui/webui/bluetooth_internals:mojo_bindings_js",
"//chrome/browser/ui/webui/downloads:mojo_bindings_js",
"//chrome/browser/ui/webui/interventions_internals:mojo_bindings_js", "//chrome/browser/ui/webui/interventions_internals:mojo_bindings_js",
"//chrome/browser/ui/webui/omnibox:mojo_bindings_js", "//chrome/browser/ui/webui/omnibox:mojo_bindings_js",
"//chrome/browser/ui/webui/usb_internals:mojo_bindings_js", "//chrome/browser/ui/webui/usb_internals:mojo_bindings_js",
...@@ -5141,7 +5140,6 @@ grit("resources") { ...@@ -5141,7 +5140,6 @@ grit("resources") {
if (!is_android && optimize_webui) { if (!is_android && optimize_webui) {
deps += [ deps += [
"//chrome/browser/resources/bookmarks:build", "//chrome/browser/resources/bookmarks:build",
"//chrome/browser/resources/downloads:build",
"//chrome/browser/resources/history:build", "//chrome/browser/resources/history:build",
] ]
if (is_chromeos) { if (is_chromeos) {
......
...@@ -158,37 +158,6 @@ ...@@ -158,37 +158,6 @@
<include name="IDR_UKM_INTERNALS_CSS" file="../../components/ukm/debug/ukm_internals.css" flattenhtml="true" compress="gzip" type="BINDATA" /> <include name="IDR_UKM_INTERNALS_CSS" file="../../components/ukm/debug/ukm_internals.css" flattenhtml="true" compress="gzip" type="BINDATA" />
<include name="IDR_TRANSLATE_INTERNALS_HTML" file="../../components/translate/translate_internals/translate_internals.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" /> <include name="IDR_TRANSLATE_INTERNALS_HTML" file="../../components/translate/translate_internals/translate_internals.html" flattenhtml="true" allowexternalscript="true" compress="gzip" type="BINDATA" />
<include name="IDR_TRANSLATE_INTERNALS_JS" file="../../components/translate/translate_internals/translate_internals.js" flattenhtml="true" compress="gzip" type="BINDATA" /> <include name="IDR_TRANSLATE_INTERNALS_JS" file="../../components/translate/translate_internals/translate_internals.js" flattenhtml="true" compress="gzip" type="BINDATA" />
<if expr="not is_android">
<include name="IDR_DOWNLOADS_IMAGES_INCOGNITO_MARKER_SVG" file="resources\downloads\images\incognito_marker.svg" type="BINDATA" />
<include name="IDR_DOWNLOADS_IMAGES_NO_DOWNLOADS_SVG" file="resources\downloads\images\no_downloads.svg" type="BINDATA" />
<include name="IDR_DOWNLOADS_MOJO_LITE_JS" file="${root_gen_dir}\chrome\browser\ui\webui\downloads\downloads.mojom-lite.js" use_base_dir="false" type="BINDATA" />
<if expr="optimize_webui">
<then>
<include name="IDR_DOWNLOADS_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\downloads\vulcanized.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_DOWNLOADS_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\downloads\crisper.js" use_base_dir="false" flattenhtml="true" type="BINDATA" compress="gzip" />
</then>
<else>
<include name="IDR_DOWNLOADS_DOWNLOADS_HTML" file="resources\downloads\downloads.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_DOWNLOADS_BROWSER_PROXY_HTML" file="resources\downloads\browser_proxy.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_BROWSER_PROXY_JS" file="resources\downloads\browser_proxy.js" type="BINDATA" />
<include name="IDR_DOWNLOADS_CONSTANTS_HTML" file="resources\downloads\constants.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_CONSTANTS_JS" file="resources\downloads\constants.js" type="BINDATA" />
<include name="IDR_DOWNLOADS_DOWNLOADS_JS" file="resources\downloads\downloads.js" type="BINDATA" />
<include name="IDR_DOWNLOADS_I18N_SETUP_HTML" file="resources\downloads\i18n_setup.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_ICON_LOADER_HTML" file="resources\downloads\icon_loader.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_ICON_LOADER_JS" file="resources\downloads\icon_loader.js" type="BINDATA" />
<include name="IDR_DOWNLOADS_ICONS_HTML" file="resources\downloads\icons.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_ITEM_HTML" file="resources\downloads\item.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_ITEM_JS" file="resources\downloads\item.js" type="BINDATA" />
<include name="IDR_DOWNLOADS_MANAGER_HTML" file="resources\downloads\manager.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_MANAGER_JS" file="resources\downloads\manager.js" type="BINDATA" />
<include name="IDR_DOWNLOADS_SEARCH_SERVICE_HTML" file="resources\downloads\search_service.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_SEARCH_SERVICE_JS" file="resources\downloads\search_service.js" type="BINDATA" />
<include name="IDR_DOWNLOADS_TOOLBAR_HTML" file="resources\downloads\toolbar.html" type="BINDATA" />
<include name="IDR_DOWNLOADS_TOOLBAR_JS" file="resources\downloads\toolbar.js" type="BINDATA" />
</else>
</if>
</if>
<include name="IDR_FEEDBACK_MANIFEST" file="resources\feedback\manifest.json" type="BINDATA" /> <include name="IDR_FEEDBACK_MANIFEST" file="resources\feedback\manifest.json" type="BINDATA" />
<if expr="is_android"> <if expr="is_android">
<include name="IDR_EXPLORE_SITES_INTERNALS_HTML" file="resources\explore_sites_internals\explore_sites_internals.html" allowexternalscript="true" compress="gzip" type="BINDATA" /> <include name="IDR_EXPLORE_SITES_INTERNALS_HTML" file="resources\explore_sites_internals\explore_sites_internals.html" allowexternalscript="true" compress="gzip" type="BINDATA" />
......
...@@ -175,6 +175,39 @@ if (!is_android) { ...@@ -175,6 +175,39 @@ if (!is_android) {
] ]
output_dir = "$root_gen_dir/chrome" output_dir = "$root_gen_dir/chrome"
} }
grit("downloads_resources") {
if (optimize_webui) {
source = "downloads/downloads_resources_vulcanized.grd"
deps = [
"//chrome/browser/resources/downloads:build",
]
} else {
source = "downloads/downloads_resources.grd"
deps = [
"//chrome/browser/ui/webui/downloads:mojo_bindings_js",
]
}
# The .grd contains references to generated files.
source_is_generated = true
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
defines = chrome_grit_defines
outputs = [
"grit/downloads_resources.h",
"grit/downloads_resources_map.cc",
"grit/downloads_resources_map.h",
"downloads_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
} }
if (is_chromeos) { if (is_chromeos) {
......
...@@ -2,21 +2,63 @@ ...@@ -2,21 +2,63 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("../optimize_webui.gni") import("../optimize_webui.gni")
optimize_webui("build") { if (optimize_webui) {
deps = [] downloads_pak_file = "downloads_resources.pak"
host = "downloads" unpak_folder = "downloads_resources.unpak"
html_in_files = [ "downloads.html" ]
html_out_files = [ "vulcanized.html" ] optimize_webui("build") {
input = rebase_path(".", root_build_dir) host = "downloads"
insert_in_head = "<base href=chrome://downloads>" html_in_files = [ "downloads.html" ]
js_out_files = [ "crisper.js" ] html_out_files = [ "vulcanized.html" ]
excludes = [ insert_in_head = "<base href=chrome://downloads>"
"chrome://resources/js/mojo_bindings_lite.js", input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir)
"chrome://downloads/downloads.mojom-lite.js", js_out_files = [ "crisper.js" ]
] excludes = [
"chrome://resources/js/mojo_bindings_lite.js",
"chrome://downloads/downloads.mojom-lite.js",
]
deps = [
":unpak",
]
}
unpak("unpak") {
pak_file = downloads_pak_file
out_folder = unpak_folder
deps = [
":flattened_resources",
]
}
grit("flattened_resources") {
source = "downloads_resources.grd"
# The .grd contains references to generated files.
source_is_generated = true
defines = chrome_grit_defines
outputs = [
"grit/downloads_resources.h",
"grit/downloads_resources_map.cc",
"grit/downloads_resources_map.h",
downloads_pak_file,
]
deps = [
"//chrome/browser/ui/webui/downloads:mojo_bindings_js",
]
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
output_dir = "$root_gen_dir/chrome/browser/resources/downloads"
}
} }
js_type_check("closure_compile") { js_type_check("closure_compile") {
......
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/downloads_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/downloads_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/downloads_resources_map.h"
type="resource_map_header" />
<output filename="downloads_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_DOWNLOADS_IMAGES_INCOGNITO_MARKER_SVG"
file="images\incognito_marker.svg"
type="BINDATA" />
<include name="IDR_DOWNLOADS_IMAGES_NO_DOWNLOADS_SVG"
file="images\no_downloads.svg"
type="BINDATA" />
<include name="IDR_DOWNLOADS_MOJO_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\downloads\downloads.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
</includes>
<structures>
<structure name="IDR_DOWNLOADS_DOWNLOADS_HTML"
file="downloads.html"
preprocess="true"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_BROWSER_PROXY_HTML"
file="browser_proxy.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_BROWSER_PROXY_JS"
file="browser_proxy.js"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_CONSTANTS_HTML"
file="constants.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_CONSTANTS_JS"
file="constants.js"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_DOWNLOADS_JS"
file="downloads.js"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_I18N_SETUP_HTML"
file="i18n_setup.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_ICON_LOADER_HTML"
file="icon_loader.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_ICON_LOADER_JS"
file="icon_loader.js" type="chrome_html" />
<structure name="IDR_DOWNLOADS_ICONS_HTML"
file="icons.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_ITEM_HTML"
file="item.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_ITEM_JS"
file="item.js"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_MANAGER_HTML"
file="manager.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_MANAGER_JS"
file="manager.js"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_SEARCH_SERVICE_HTML"
file="search_service.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_SEARCH_SERVICE_JS"
file="search_service.js"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_TOOLBAR_HTML"
file="toolbar.html"
type="chrome_html" />
<structure name="IDR_DOWNLOADS_TOOLBAR_JS"
file="toolbar.js"
type="chrome_html" />
</structures>
</release>
</grit>
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/downloads_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/downloads_resources_map.cc"
type="resource_map_source" />
<output filename="grit/downloads_resources_map.h"
type="resource_map_header" />
<output filename="downloads_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_DOWNLOADS_IMAGES_INCOGNITO_MARKER_SVG"
file="images\incognito_marker.svg"
type="BINDATA" />
<include name="IDR_DOWNLOADS_IMAGES_NO_DOWNLOADS_SVG"
file="images\no_downloads.svg"
type="BINDATA" />
<include name="IDR_DOWNLOADS_MOJO_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\downloads\downloads.mojom-lite.js"
use_base_dir="false"
compress="gzip"
type="BINDATA" />
<include name="IDR_DOWNLOADS_VULCANIZED_HTML"
file="${root_gen_dir}\chrome\browser\resources\downloads\vulcanized.html"
use_base_dir="false"
preprocess="true"
compress="gzip"
type="BINDATA" />
<include name="IDR_DOWNLOADS_CRISPER_JS"
file="${root_gen_dir}\chrome\browser\resources\downloads\crisper.js"
use_base_dir="false"
preprocess="true"
compress="gzip"
type="BINDATA" />
</includes>
</release>
</grit>
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "chrome/grit/downloads_resources.h"
#include "chrome/grit/downloads_resources_map.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h" #include "chrome/grit/theme_resources.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
...@@ -142,25 +143,10 @@ content::WebUIDataSource* CreateDownloadsUIHTMLSource(Profile* profile) { ...@@ -142,25 +143,10 @@ content::WebUIDataSource* CreateDownloadsUIHTMLSource(Profile* profile) {
source->AddResourcePath("crisper.js", IDR_DOWNLOADS_CRISPER_JS); source->AddResourcePath("crisper.js", IDR_DOWNLOADS_CRISPER_JS);
source->SetDefaultResource(IDR_DOWNLOADS_VULCANIZED_HTML); source->SetDefaultResource(IDR_DOWNLOADS_VULCANIZED_HTML);
#else #else
source->AddResourcePath("browser_proxy.html", for (size_t i = 0; i < kDownloadsResourcesSize; ++i) {
IDR_DOWNLOADS_BROWSER_PROXY_HTML); source->AddResourcePath(kDownloadsResources[i].name,
source->AddResourcePath("browser_proxy.js", IDR_DOWNLOADS_BROWSER_PROXY_JS); kDownloadsResources[i].value);
source->AddResourcePath("constants.html", IDR_DOWNLOADS_CONSTANTS_HTML); }
source->AddResourcePath("constants.js", IDR_DOWNLOADS_CONSTANTS_JS);
source->AddResourcePath("downloads.js", IDR_DOWNLOADS_DOWNLOADS_JS);
source->AddResourcePath("i18n_setup.html", IDR_DOWNLOADS_I18N_SETUP_HTML);
source->AddResourcePath("icon_loader.html", IDR_DOWNLOADS_ICON_LOADER_HTML);
source->AddResourcePath("icon_loader.js", IDR_DOWNLOADS_ICON_LOADER_JS);
source->AddResourcePath("icons.html", IDR_DOWNLOADS_ICONS_HTML);
source->AddResourcePath("item.html", IDR_DOWNLOADS_ITEM_HTML);
source->AddResourcePath("item.js", IDR_DOWNLOADS_ITEM_JS);
source->AddResourcePath("manager.html", IDR_DOWNLOADS_MANAGER_HTML);
source->AddResourcePath("manager.js", IDR_DOWNLOADS_MANAGER_JS);
source->AddResourcePath("search_service.html",
IDR_DOWNLOADS_SEARCH_SERVICE_HTML);
source->AddResourcePath("search_service.js", IDR_DOWNLOADS_SEARCH_SERVICE_JS);
source->AddResourcePath("toolbar.html", IDR_DOWNLOADS_TOOLBAR_HTML);
source->AddResourcePath("toolbar.js", IDR_DOWNLOADS_TOOLBAR_JS);
source->SetDefaultResource(IDR_DOWNLOADS_DOWNLOADS_HTML); source->SetDefaultResource(IDR_DOWNLOADS_DOWNLOADS_HTML);
#endif #endif
......
...@@ -138,6 +138,7 @@ template("chrome_extra_paks") { ...@@ -138,6 +138,7 @@ template("chrome_extra_paks") {
# New paks should be added here by default. # New paks should be added here by default.
sources += [ sources += [
"$root_gen_dir/chrome/component_extension_resources.pak", "$root_gen_dir/chrome/component_extension_resources.pak",
"$root_gen_dir/chrome/downloads_resources.pak",
"$root_gen_dir/chrome/local_ntp_resources.pak", "$root_gen_dir/chrome/local_ntp_resources.pak",
"$root_gen_dir/chrome/settings_resources.pak", "$root_gen_dir/chrome/settings_resources.pak",
"$root_gen_dir/content/browser/devtools/devtools_resources.pak", "$root_gen_dir/content/browser/devtools/devtools_resources.pak",
...@@ -145,6 +146,7 @@ template("chrome_extra_paks") { ...@@ -145,6 +146,7 @@ template("chrome_extra_paks") {
] ]
deps += [ deps += [
"//chrome/browser/resources:component_extension_resources", "//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:downloads_resources",
"//chrome/browser/resources:local_ntp_resources", "//chrome/browser/resources:local_ntp_resources",
"//chrome/browser/resources:settings_resources", "//chrome/browser/resources:settings_resources",
"//content/browser/devtools:devtools_resources", "//content/browser/devtools:devtools_resources",
......
...@@ -81,29 +81,36 @@ ...@@ -81,29 +81,36 @@
# START chrome/browser section. # START chrome/browser section.
"chrome/browser/browser_resources.grd": { "chrome/browser/browser_resources.grd": {
"includes": [11000], "includes": [11000],
"structures": [12000], "structures": [11900],
}, },
"chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd": { "chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd": {
"structures": [12040], "structures": [11940],
}, },
"chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_resources.grd": { "chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_resources.grd": {
"structures": [12045], "structures": [11945],
}, },
"chrome/browser/resources/component_extension_resources.grd": { "chrome/browser/resources/component_extension_resources.grd": {
"includes": [12100], "includes": [12000],
"structures": [12350], "structures": [12250],
}, },
"chrome/browser/resources/invalidations_resources.grd": { "chrome/browser/resources/downloads/downloads_resources_vulcanized.grd": {
"includes": [12400], "includes": [12300],
}, },
"chrome/browser/resources/local_ntp/local_ntp_resources.grd": { "chrome/browser/resources/downloads/downloads_resources.grd": {
"includes": [12440], "includes": [12310],
"structures": [12320],
}, },
"chrome/browser/resources/extensions/extensions_resources_vulcanized.grd": { "chrome/browser/resources/extensions/extensions_resources_vulcanized.grd": {
"includes": [12500], "includes": [12400],
}, },
"chrome/browser/resources/extensions/extensions_resources.grd": { "chrome/browser/resources/extensions/extensions_resources.grd": {
"structures": [12510], "structures": [12410],
},
"chrome/browser/resources/invalidations_resources.grd": {
"includes": [12500],
},
"chrome/browser/resources/local_ntp/local_ntp_resources.grd": {
"includes": [12540],
}, },
"chrome/browser/resources/net_internals/net_internals_resources.grd": { "chrome/browser/resources/net_internals/net_internals_resources.grd": {
"includes": [12600], "includes": [12600],
......
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