Commit 6ad53382 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Bookmarks Web UI: Create separate grd files, use unpak folder

Change the bookmarks Web UI build to be more similar to other Web UI
pages (e.g. extensions, settings, Print Preview) by adding individual
grd files for its resources, and building the optimized page from
an unpak folder.

This will allow the page to leverage existing logic in unpack_pak to
place generated Polymer 3 JS files and non-generated JS module files
in the same folder structure for bundling when the page is migrated
to Polymer 3.

Bug: 1022213
Change-Id: If27d96cefbca79f7b4b238b5123482dab465b4c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904450Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713921}
parent 7f3bb5b5
...@@ -1560,6 +1560,7 @@ group("extra_resources") { ...@@ -1560,6 +1560,7 @@ group("extra_resources") {
if (!is_android) { if (!is_android) {
public_deps += [ public_deps += [
"//chrome/browser/resources:bookmarks_resources",
"//chrome/browser/resources:component_extension_resources", "//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:dev_ui_paks", "//chrome/browser/resources:dev_ui_paks",
"//chrome/browser/resources:downloads_resources", "//chrome/browser/resources:downloads_resources",
......
...@@ -20,57 +20,6 @@ ...@@ -20,57 +20,6 @@
<structure name="IDR_NEW_TAB_4_HTML" file="resources\ntp4\new_tab.html" compress="gzip" flattenhtml="true" type="chrome_html" /> <structure name="IDR_NEW_TAB_4_HTML" file="resources\ntp4\new_tab.html" compress="gzip" flattenhtml="true" type="chrome_html" />
<structure name="IDR_NEW_TAB_4_THEME_CSS" file="resources\ntp4\new_tab_theme.css" compress="gzip" flattenhtml="true" type="chrome_html" /> <structure name="IDR_NEW_TAB_4_THEME_CSS" file="resources\ntp4\new_tab_theme.css" compress="gzip" flattenhtml="true" type="chrome_html" />
<!-- Bookmarks WebUI. -->
<if expr="optimize_webui">
<then>
<structure name="IDR_BOOKMARKS_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\bookmarks\vulcanized.html" use_base_dir="false" preprocess="true" type="chrome_html" compress="gzip" />
<structure name="IDR_BOOKMARKS_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\bookmarks\crisper.js" use_base_dir="false" preprocess="true" type="chrome_html" compress="gzip" />
</then>
<else>
<structure name="IDR_BOOKMARKS_ACTIONS_HTML" file="resources\bookmarks\actions.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_ACTIONS_JS" file="resources\bookmarks\actions.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_API_LISTENER_HTML" file="resources\bookmarks\api_listener.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_API_LISTENER_JS" file="resources\bookmarks\api_listener.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_APP_HTML" file="resources\bookmarks\app.html" type="chrome_html" preprocess="true" />
<structure name="IDR_BOOKMARKS_APP_JS" file="resources\bookmarks\app.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_BOOKMARKS_HTML" file="resources\bookmarks\bookmarks.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_COMMAND_MANAGER_HTML" file="resources\bookmarks\command_manager.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_COMMAND_MANAGER_JS" file="resources\bookmarks\command_manager.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_CONSTANTS_HTML" file="resources\bookmarks\constants.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_CONSTANTS_JS" file="resources\bookmarks\constants.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_DEBOUNCER_HTML" file="resources\bookmarks\debouncer.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_DEBOUNCER_JS" file="resources\bookmarks\debouncer.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_DIALOG_FOCUS_MANAGER_HTML" file="resources\bookmarks\dialog_focus_manager.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_DIALOG_FOCUS_MANAGER_JS" file="resources\bookmarks\dialog_focus_manager.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_DND_MANAGER_HTML" file="resources\bookmarks\dnd_manager.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_DND_MANAGER_JS" file="resources\bookmarks\dnd_manager.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_EDIT_DIALOG_HTML" file="resources\bookmarks\edit_dialog.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_EDIT_DIALOG_JS" file="resources\bookmarks\edit_dialog.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_FOLDER_NODE_HTML" file="resources\bookmarks\folder_node.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_FOLDER_NODE_JS" file="resources\bookmarks\folder_node.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_ITEM_HTML" file="resources\bookmarks\item.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_ITEM_JS" file="resources\bookmarks\item.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_LIST_HTML" file="resources\bookmarks\list.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_LIST_JS" file="resources\bookmarks\list.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_MOUSE_FOCUS_BEHAVIOR_HTML" file="resources\bookmarks\mouse_focus_behavior.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_MOUSE_FOCUS_BEHAVIOR_JS" file="resources\bookmarks\mouse_focus_behavior.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_REDUCERS_HTML" file="resources\bookmarks\reducers.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_REDUCERS_JS" file="resources\bookmarks\reducers.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_ROUTER_HTML" file="resources\bookmarks\router.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_ROUTER_JS" file="resources\bookmarks\router.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_SHARED_STYLE_HTML" file="resources\bookmarks\shared_style.html" preprocess="true" type="chrome_html" />
<structure name="IDR_BOOKMARKS_SHARED_VARS_HTML" file="resources\bookmarks\shared_vars.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_CLIENT_HTML" file="resources\bookmarks\store_client.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_CLIENT_JS" file="resources\bookmarks\store_client.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_HTML" file="resources\bookmarks\store.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_JS" file="resources\bookmarks\store.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_STRINGS_HTML" file="resources\bookmarks\strings.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_TOOLBAR_HTML" file="resources\bookmarks\toolbar.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_TOOLBAR_JS" file="resources\bookmarks\toolbar.js" type="chrome_html" />
<structure name="IDR_BOOKMARKS_UTIL_HTML" file="resources\bookmarks\util.html" type="chrome_html" />
<structure name="IDR_BOOKMARKS_UTIL_JS" file="resources\bookmarks\util.js" type="chrome_html" />
</else>
</if>
</if> </if>
<if expr="chromeos"> <if expr="chromeos">
<structure name="IDR_FIRST_RUN_HTML" file="resources\chromeos\first_run\first_run.html" compress="gzip" flattenhtml="true" type="chrome_html" /> <structure name="IDR_FIRST_RUN_HTML" file="resources\chromeos\first_run\first_run.html" compress="gzip" flattenhtml="true" type="chrome_html" />
......
...@@ -108,6 +108,34 @@ grit("webapks_ui_resources") { ...@@ -108,6 +108,34 @@ grit("webapks_ui_resources") {
} }
if (!is_android) { if (!is_android) {
grit("bookmarks_resources") {
if (optimize_webui) {
source = "bookmarks/bookmarks_resources_vulcanized.grd"
# The .grd contains references to generated files.
source_is_generated = true
deps = [
"//chrome/browser/resources/bookmarks:build",
]
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
} else {
source = "bookmarks/bookmarks_resources.grd"
}
defines = chrome_grit_defines
outputs = [
"grit/bookmarks_resources.h",
"grit/bookmarks_resources_map.cc",
"grit/bookmarks_resources_map.h",
"bookmarks_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
grit("component_extension_resources") { grit("component_extension_resources") {
source = "component_extension_resources.grd" source = "component_extension_resources.grd"
......
...@@ -2,18 +2,52 @@ ...@@ -2,18 +2,52 @@
# 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) {
host = "bookmarks" bookmarks_pak_file = "bookmarks_resources.pak"
html_in_files = [ "bookmarks.html" ] unpak_folder = "bookmarks_resources.unpak"
html_out_files = [ "vulcanized.html" ]
input = rebase_path(".", root_build_dir) optimize_webui("build") {
js_out_files = [ "crisper.js" ] host = "bookmarks"
html_in_files = [ "bookmarks.html" ]
html_out_files = [ "vulcanized.html" ]
deps = [] input = rebase_path(".", root_build_dir)
js_out_files = [ "crisper.js" ]
deps = [
":unpak",
]
}
unpak("unpak") {
pak_file = bookmarks_pak_file
out_folder = unpak_folder
deps = [
":flattened_resources",
]
}
grit("flattened_resources") {
source = "bookmarks_resources.grd"
# The .grd contains references to generated files.
source_is_generated = true
defines = chrome_grit_defines
outputs = [
"grit/bookmarks_resources.h",
"grit/bookmarks_resources_map.cc",
"grit/bookmarks_resources_map.h",
bookmarks_pak_file,
]
output_dir = "$root_gen_dir/chrome/browser/resources/bookmarks"
}
} }
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/bookmarks_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/bookmarks_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/bookmarks_resources_map.h"
type="resource_map_header" />
<output filename="bookmarks_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<structures>
<structure name="IDR_BOOKMARKS_ACTIONS_HTML"
file="actions.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_ACTIONS_JS"
file="actions.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_API_LISTENER_HTML"
file="api_listener.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_API_LISTENER_JS"
file="api_listener.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_APP_HTML"
file="app.html"
type="chrome_html"
preprocess="true" />
<structure name="IDR_BOOKMARKS_APP_JS"
file="app.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_BOOKMARKS_HTML"
file="bookmarks.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_COMMAND_MANAGER_HTML"
file="command_manager.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_COMMAND_MANAGER_JS"
file="command_manager.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_CONSTANTS_HTML"
file="constants.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_CONSTANTS_JS"
file="constants.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DEBOUNCER_HTML"
file="debouncer.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DEBOUNCER_JS"
file="debouncer.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DIALOG_FOCUS_MANAGER_HTML"
file="dialog_focus_manager.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DIALOG_FOCUS_MANAGER_JS"
file="dialog_focus_manager.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DND_MANAGER_HTML"
file="dnd_manager.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_DND_MANAGER_JS"
file="dnd_manager.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_EDIT_DIALOG_HTML"
file="edit_dialog.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_EDIT_DIALOG_JS"
file="edit_dialog.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_FOLDER_NODE_HTML"
file="folder_node.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_FOLDER_NODE_JS"
file="folder_node.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_ITEM_HTML"
file="item.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_ITEM_JS"
file="item.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_LIST_HTML"
file="list.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_LIST_JS"
file="list.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_MOUSE_FOCUS_BEHAVIOR_HTML"
file="mouse_focus_behavior.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_MOUSE_FOCUS_BEHAVIOR_JS"
file="mouse_focus_behavior.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_REDUCERS_HTML"
file="reducers.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_REDUCERS_JS"
file="reducers.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_ROUTER_HTML"
file="router.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_ROUTER_JS"
file="router.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_SHARED_STYLE_HTML"
file="shared_style.html"
preprocess="true"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_SHARED_VARS_HTML"
file="shared_vars.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_CLIENT_HTML"
file="store_client.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_CLIENT_JS"
file="store_client.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_HTML"
file="store.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_STORE_JS"
file="store.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_STRINGS_HTML"
file="strings.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_TOOLBAR_HTML"
file="toolbar.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_TOOLBAR_JS"
file="toolbar.js"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_UTIL_HTML"
file="util.html"
type="chrome_html" />
<structure name="IDR_BOOKMARKS_UTIL_JS"
file="util.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/bookmarks_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/bookmarks_resources_map.cc"
type="resource_map_source" />
<output filename="grit/bookmarks_resources_map.h"
type="resource_map_header" />
<output filename="bookmarks_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<structures>
<structure name="IDR_BOOKMARKS_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\bookmarks\vulcanized.html" use_base_dir="false" preprocess="true" type="chrome_html" compress="gzip" />
<structure name="IDR_BOOKMARKS_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\bookmarks\crisper.js" use_base_dir="false" preprocess="true" type="chrome_html" compress="gzip" />
</structures>
</release>
</grit>
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
#include "chrome/browser/ui/webui/plural_string_handler.h" #include "chrome/browser/ui/webui/plural_string_handler.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/bookmarks_resources.h"
#include "chrome/grit/bookmarks_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/favicon_base/favicon_url_parser.h" #include "components/favicon_base/favicon_url_parser.h"
......
...@@ -133,6 +133,7 @@ template("chrome_extra_paks") { ...@@ -133,6 +133,7 @@ template("chrome_extra_paks") {
} else { } else {
# New paks should be added here by default. # New paks should be added here by default.
sources += [ sources += [
"$root_gen_dir/chrome/bookmarks_resources.pak",
"$root_gen_dir/chrome/component_extension_resources.pak", "$root_gen_dir/chrome/component_extension_resources.pak",
"$root_gen_dir/chrome/dev_ui_resources.pak", "$root_gen_dir/chrome/dev_ui_resources.pak",
"$root_gen_dir/chrome/downloads_resources.pak", "$root_gen_dir/chrome/downloads_resources.pak",
...@@ -142,6 +143,7 @@ template("chrome_extra_paks") { ...@@ -142,6 +143,7 @@ template("chrome_extra_paks") {
"$root_gen_dir/headless/headless_lib_resources.pak", "$root_gen_dir/headless/headless_lib_resources.pak",
] ]
deps += [ deps += [
"//chrome/browser/resources:bookmarks_resources",
"//chrome/browser/resources:component_extension_resources", "//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:dev_ui_paks", "//chrome/browser/resources:dev_ui_paks",
"//chrome/browser/resources:downloads_resources", "//chrome/browser/resources:downloads_resources",
......
...@@ -83,22 +83,28 @@ ...@@ -83,22 +83,28 @@
"includes": [11000], "includes": [11000],
"structures": [11800], "structures": [11800],
}, },
"chrome/browser/resources/bookmarks/bookmarks_resources.grd": {
"structures": [11830],
},
"chrome/browser/resources/bookmarks/bookmarks_resources_vulcanized.grd": {
"structures": [11880],
},
"chrome/browser/resources/chromeos/camera/camera_resources.grd": { "chrome/browser/resources/chromeos/camera/camera_resources.grd": {
"includes": [11870], "includes": [11890],
"structures": [11930], "structures": [11950],
}, },
"chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd": { "chrome/browser/resources/chromeos/camera/src/strings/camera_strings.grd": {
"messages": [11970], "messages": [12000],
}, },
"chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd": { "chrome/browser/resources/chromeos/cellular_setup/cellular_setup_resources.grd": {
"structures": [12040], "structures": [12080],
}, },
"chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_resources.grd": { "chrome/browser/resources/chromeos/multidevice_setup/multidevice_setup_resources.grd": {
"structures": [12050], "structures": [12090],
}, },
"chrome/browser/resources/component_extension_resources.grd": { "chrome/browser/resources/component_extension_resources.grd": {
"includes": [12060], "includes": [12100],
"structures": [12200], "structures": [12230],
}, },
"chrome/browser/resources/downloads/downloads_resources_vulcanized.grd": { "chrome/browser/resources/downloads/downloads_resources_vulcanized.grd": {
"includes": [12240], "includes": [12240],
......
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