| # Copyright 2018 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/chromeos/ui_mode.gni") |
| import("//chrome/common/features.gni") |
| import("//printing/buildflags/buildflags.gni") |
| import("//third_party/closure_compiler/compile_js.gni") |
| import("//tools/grit/grit_rule.gni") |
| import("//tools/grit/preprocess_if_expr.gni") |
| import("//ui/webui/resources/tools/generate_grd.gni") |
| import("../tools/optimize_webui.gni") |
| |
| assert(enable_print_preview, "enable_print_preview check failed") |
| |
| preprocess_folder = "preprocessed" |
| preprocess_manifest = "preprocessed_manifest.json" |
| preprocess_gen_manifest = "preprocessed_gen_manifest.json" |
| preprocess_pdf_manifest = "preprocessed_pdf_manifest.json" |
| preprocess_pdf_gen_manifest = "preprocessed_pdf_gen_manifest.json" |
| |
| if (optimize_webui) { |
| build_manifest = "build_manifest.json" |
| |
| optimize_webui("build") { |
| host = "print" |
| input = rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir) |
| js_out_files = [ "print_preview.rollup.js" ] |
| js_module_in_files = [ "print_preview.js" ] |
| out_manifest = "$target_gen_dir/$build_manifest" |
| |
| deps = [ |
| ":preprocess", |
| ":preprocess_generated", |
| "../../../../ui/webui/resources:preprocess", |
| ] |
| excludes = [ |
| "chrome://resources/js/cr.m.js", |
| "pdf/pdf_scripting_api.js", |
| ] |
| } |
| } |
| |
| generate_grd("build_grd") { |
| input_files = [ "print_preview.html" ] |
| input_files_base_dir = rebase_path(".", "//") |
| deps = [ |
| ":preprocess_pdf", |
| ":preprocess_pdf_generated", |
| ] |
| manifest_files = [ |
| "$target_gen_dir/$preprocess_pdf_manifest", |
| "$target_gen_dir/$preprocess_pdf_gen_manifest", |
| ] |
| resource_path_rewrites = [ |
| "pdf/index_pp.html|pdf/index.html", |
| |
| # Expose pdf_viewer_pp.js as pdf_viewer_wrapper.js so that the PDF viewer |
| # and Print Preview viewer can use the same main.js source. |
| "pdf/pdf_viewer_pp.js|pdf/pdf_viewer_wrapper.js", |
| ] |
| if (optimize_webui) { |
| deps += [ ":build" ] |
| resource_path_rewrites += [ "print_preview.rollup.js|print_preview.js" ] |
| manifest_files += [ "$target_gen_dir/$build_manifest" ] |
| } else { |
| deps += [ |
| ":preprocess", |
| ":preprocess_generated", |
| ] |
| manifest_files += [ |
| "$target_gen_dir/$preprocess_manifest", |
| "$target_gen_dir/$preprocess_gen_manifest", |
| ] |
| } |
| grd_prefix = "print_preview" |
| out_grd = "$target_gen_dir/${grd_prefix}_resources.grd" |
| } |
| |
| preprocess_if_expr("preprocess") { |
| in_folder = "./" |
| out_folder = "$target_gen_dir/$preprocess_folder" |
| out_manifest = "$target_gen_dir/$preprocess_manifest" |
| 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/cdd.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", |
| ] |
| |
| if (is_chromeos_ash) { |
| in_files += [ |
| "data/print_server_store.js", |
| "data/printer_status_cros.js", |
| "native_layer_cros.js", |
| ] |
| } |
| } |
| |
| preprocess_if_expr("preprocess_generated") { |
| deps = [ "ui:web_components" ] |
| in_folder = target_gen_dir |
| out_folder = "$target_gen_dir/$preprocess_folder" |
| out_manifest = "$target_gen_dir/$preprocess_gen_manifest" |
| in_files = [ |
| "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_css.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/invitation_promo.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/scaling_settings.js", |
| "ui/settings_section.js", |
| "ui/settings_select.js", |
| "ui/sidebar.js", |
| "ui/throbber_css.js", |
| ] |
| |
| if (is_chromeos_ash) { |
| in_files += [ |
| "ui/destination_dropdown_cros.js", |
| "ui/destination_select_cros.js", |
| "ui/pin_settings.js", |
| "ui/provisional_destination_resolver.js", |
| "ui/destination_dialog_cros.js", |
| ] |
| } else { |
| in_files += [ |
| "ui/destination_select.js", |
| "ui/link_container.js", |
| "ui/destination_dialog.js", |
| ] |
| } |
| } |
| |
| preprocess_if_expr("preprocess_pdf") { |
| in_folder = "../" |
| out_folder = "$target_gen_dir/$preprocess_folder" |
| out_manifest = "$target_gen_dir/$preprocess_pdf_manifest" |
| in_files = [ |
| "pdf/browser_api.js", |
| "pdf/constants.js", |
| "pdf/controller.js", |
| "pdf/gesture_detector.js", |
| "pdf/index.css", |
| "pdf/index_pp.html", |
| "pdf/main.js", |
| "pdf/metrics.js", |
| "pdf/open_pdf_params_parser.js", |
| "pdf/pdf_scripting_api.js", |
| "pdf/pdf_viewer_utils.js", |
| "pdf/pdf_viewer_base.js", |
| "pdf/toolbar_manager.js", |
| "pdf/viewport.js", |
| "pdf/viewport_scroller.js", |
| "pdf/zoom_manager.js", |
| ] |
| } |
| |
| preprocess_if_expr("preprocess_pdf_generated") { |
| deps = [ "../pdf:web_components" ] |
| in_folder = get_path_info("..", "gen_dir") |
| out_folder = "$target_gen_dir/$preprocess_folder" |
| out_manifest = "$target_gen_dir/$preprocess_pdf_gen_manifest" |
| in_files = [ |
| "pdf/elements/icons.js", |
| "pdf/elements/shared-vars.js", |
| "pdf/elements/viewer-error-screen.js", |
| "pdf/elements/viewer-page-indicator.js", |
| "pdf/elements/viewer-zoom-button.js", |
| "pdf/elements/viewer-zoom-toolbar.js", |
| "pdf/pdf_viewer_pp.js", |
| "pdf/pdf_viewer_shared_style.js", |
| ] |
| } |
| |
| grit("resources") { |
| defines = chrome_grit_defines |
| |
| # These arguments are needed since the grd is generated at build time. |
| enable_input_discovery_for_gn_analyze = false |
| source = "$target_gen_dir/print_preview_resources.grd" |
| deps = [ ":build_grd" ] |
| |
| outputs = [ |
| "grit/print_preview_resources.h", |
| "grit/print_preview_resources_map.cc", |
| "grit/print_preview_resources_map.h", |
| "print_preview_resources.pak", |
| ] |
| output_dir = "$root_gen_dir/chrome" |
| } |
| |
| group("closure_compile") { |
| deps = [ |
| ":print_preview_module_resources", |
| "data:closure_compile_module", |
| "ui:closure_compile_module", |
| ] |
| } |
| |
| js_type_check("print_preview_module_resources") { |
| is_polymer3 = true |
| deps = [ |
| ":cloud_print_interface", |
| ":cloud_print_interface_impl", |
| ":dark_mode_behavior", |
| ":metrics", |
| ":native_layer", |
| ":native_layer_cros", |
| ":print_preview", |
| ":print_preview_utils", |
| ] |
| } |
| |
| js_library("print_preview") { |
| deps = [ |
| ":cloud_print_interface", |
| ":native_layer", |
| ":native_layer_cros", |
| "data:destination", |
| "data:destination_store", |
| "data:local_parsers", |
| "data:measurement_system", |
| "ui:app", |
| "ui:settings_select", |
| ] |
| |
| if (is_chromeos_ash) { |
| deps += [ "data:print_server_store" ] |
| } |
| } |
| |
| js_library("print_preview_utils") { |
| deps = [ |
| ":dark_mode_behavior", |
| "//third_party/polymer/v3_0/components-chromium/iron-iconset-svg:iron-iconset-svg", |
| "//ui/webui/resources/js:util.m", |
| ] |
| } |
| |
| js_library("metrics") { |
| deps = [ ":native_layer" ] |
| } |
| |
| js_library("cloud_print_interface") { |
| deps = [ |
| ":native_layer", |
| "data:destination", |
| "data:invitation", |
| "//ui/webui/resources/js/cr:event_target.m", |
| ] |
| } |
| |
| js_library("cloud_print_interface_impl") { |
| deps = [ |
| ":cloud_print_interface", |
| ":native_layer_cros", |
| "data:cloud_parsers", |
| "data:destination", |
| "data:invitation", |
| "//ui/webui/resources/js:assert.m", |
| "//ui/webui/resources/js:cr.m", |
| "//ui/webui/resources/js/cr:event_target.m", |
| ] |
| } |
| |
| js_library("native_layer") { |
| deps = [ |
| "data:cdd", |
| "data:destination", |
| "data:destination_match", |
| "data:measurement_system", |
| "//ui/webui/resources/js:assert.m", |
| "//ui/webui/resources/js:cr.m", |
| ] |
| } |
| |
| js_library("native_layer_cros") { |
| deps = [ |
| "data:destination_policies", |
| "data:printer_status_cros", |
| "//ui/webui/resources/js:assert.m", |
| "//ui/webui/resources/js:cr.m", |
| ] |
| } |
| |
| js_library("dark_mode_behavior") { |
| deps = [ "//ui/webui/resources/js:assert.m" ] |
| } |