Commit fd5b26b8 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Web UI: Change Print Preview to use preprocess instead of pak/unpak

Proof of concept CL updating Print Preview to use the new
grit_preprocess build rule to generate inputs for rollup, instead of
generating a pak file and unpak folder from the grd file.

Bug: 1071641
Change-Id: Ic9a15c6c546be979ce68ad4d90537c142163a024
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2370162Reviewed-by: default avatardpapad <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802281}
parent a0e011b6
...@@ -4,22 +4,21 @@ ...@@ -4,22 +4,21 @@
import("//chrome/common/features.gni") 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("//tools/grit/preprocess_grit.gni")
import("//tools/polymer/polymer.gni")
import("../optimize_webui.gni") import("../optimize_webui.gni")
if (optimize_webui) { if (optimize_webui) {
print_preview_pak_file = "print_preview_resources.pak" preprocess_folder = "print_preview_preprocessed"
unpak_folder = "print_preview_resources.unpak"
optimize_webui("build") { optimize_webui("build") {
host = "print" host = "print"
input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir) input = rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir)
js_out_files = [ "print_preview.rollup.js" ] js_out_files = [ "print_preview.rollup.js" ]
js_module_in_files = [ "print_preview.js" ] js_module_in_files = [ "print_preview.js" ]
deps = [ deps = [
":unpak", ":preprocess",
":preprocess_generated",
"../../../../ui/webui/resources:modulize", "../../../../ui/webui/resources:modulize",
] ]
excludes = [ excludes = [
...@@ -28,33 +27,103 @@ if (optimize_webui) { ...@@ -28,33 +27,103 @@ if (optimize_webui) {
] ]
} }
unpak("unpak") { preprocess_grit("preprocess") {
pak_file = print_preview_pak_file in_folder = "./"
out_folder = unpak_folder out_folder = "$target_gen_dir/$preprocess_folder"
in_files = [
"cloud_print_interface.js",
"cloud_print_interface_impl.js",
"dark_mode_behavior.js",
"metrics.js",
"native_layer.js",
"print_preview.js",
"print_preview_utils.js",
"data/cloud_parsers.js",
"data/coordinate2d.js",
"data/destination.js",
"data/destination_match.js",
"data/destination_policies.js",
"data/destination_store.js",
"data/document_info.js",
"data/invitation.js",
"data/invitation_store.js",
"data/local_parsers.js",
"data/margins.js",
"data/measurement_system.js",
"data/model.js",
"data/printable_area.js",
"data/scaling.js",
"data/size.js",
"data/state.js",
"data/user_manager.js",
"ui/highlight_utils.js",
"ui/input_behavior.js",
"ui/plugin_proxy.js",
"ui/select_behavior.js",
"ui/settings_behavior.js",
]
deps = [ ":flattened_resources" ] if (is_chromeos) {
in_files += [ "data/printer_status_cros.js" ]
}
} }
grit("flattened_resources") { preprocess_grit("preprocess_generated") {
source = "print_preview_resources.grd" deps = [ "ui:web_components" ]
in_folder = target_gen_dir
grit_flags = [ out_folder = "$target_gen_dir/$preprocess_folder"
"-E", in_files = [
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), "ui/advanced_options_settings.js",
"ui/advanced_settings_dialog.js",
"ui/advanced_settings_item.js",
"ui/app.js",
"ui/button_strip.js",
"ui/color_settings.js",
"ui/copies_settings.js",
"ui/destination_dialog.js",
"ui/destination_list.js",
"ui/destination_list_item.js",
"ui/destination_select_css.js",
"ui/destination_settings.js",
"ui/dpi_settings.js",
"ui/duplex_settings.js",
"ui/header.js",
"ui/icons.js",
"ui/layout_settings.js",
"ui/margin_control.js",
"ui/margin_control_container.js",
"ui/margins_settings.js",
"ui/media_size_settings.js",
"ui/more_settings.js",
"ui/number_settings_section.js",
"ui/other_options_settings.js",
"ui/pages_per_sheet_settings.js",
"ui/pages_settings.js",
"ui/preview_area.js",
"ui/print_preview_search_box.js",
"ui/print_preview_shared_css.js",
"ui/print_preview_vars_css.js",
"ui/provisional_destination_resolver.js",
"ui/scaling_settings.js",
"ui/settings_section.js",
"ui/settings_select.js",
"ui/sidebar.js",
"ui/throbber_css.js",
] ]
deps = [ if (is_chromeos) {
"../pdf:web_components", in_files += [
"ui:web_components", "ui/destination_dropdown_cros.js",
] "ui/destination_select_cros.js",
defines = chrome_grit_defines "ui/pin_settings.js",
outputs = [ "ui/printer_status_icon_cros.js",
"grit/print_preview_resources.h", ]
"grit/print_preview_resources_map.cc", } else {
"grit/print_preview_resources_map.h", in_files += [
print_preview_pak_file, "ui/destination_select.js",
] "ui/link_container.js",
output_dir = "$root_gen_dir/chrome/browser/resources/print_preview" ]
}
} }
} }
......
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