blob: 9f44cdc11a7a5ac0bce8090e984f41340086b10b [file] [log] [blame]
# Copyright 2019 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("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/preprocess_if_expr.gni")
import("//tools/polymer/html_to_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
preprocess_folder = "preprocessed"
preprocess_web_components_manifest = "preprocessed_gen_manifest.json"
# Compile the .grd file produced by the "build_grd" target below.
grit("cast_feedback_ui_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/media_router_feedback_resources.grd"
deps = [ ":build_grd" ]
outputs = [
"grit/media_router_feedback_resources.h",
"grit/media_router_feedback_resources_map.cc",
"grit/media_router_feedback_resources_map.h",
"media_router_feedback_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
# Build a .grd file from the various resource files needed by the
# feedback dialog.
generate_grd("build_grd") {
input_files = [ "feedback.html" ]
input_files_base_dir = rebase_path(".", "//")
deps = [ ":preprocess_web_components" ]
manifest_files = [ "$target_gen_dir/$preprocess_web_components_manifest" ]
grd_prefix = "media_router_feedback"
out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
}
preprocess_if_expr("preprocess_web_components") {
deps = [ ":web_components" ]
in_folder = target_gen_dir
out_folder = "$target_gen_dir/$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_web_components_manifest"
in_files = [ "cast_feedback_ui.js" ]
}
js_type_check("closure_compile") {
is_polymer3 = true
deps = [
":cast_feedback_ui",
":media_router_internals",
]
}
js_library("cast_feedback_ui") {
deps = [
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/cr_elements/cr_button:cr_button.m",
"//ui/webui/resources/cr_elements/cr_checkbox:cr_checkbox.m",
"//ui/webui/resources/cr_elements/cr_dialog:cr_dialog.m",
"//ui/webui/resources/cr_elements/cr_input:cr_input.m",
"//ui/webui/resources/cr_elements/cr_radio_button:cr_radio_button.m",
"//ui/webui/resources/cr_elements/cr_radio_group:cr_radio_group.m",
"//ui/webui/resources/js:cr.m",
"//ui/webui/resources/js:load_time_data.m",
]
externs_list = [
"$externs_path/feedback_private.js",
"$externs_path/chrome_send.js",
]
}
js_library("media_router_internals") {
deps = [
"//ui/webui/resources/js:cr.m",
"//ui/webui/resources/js:util.m",
]
}
# Expand {__html_template__} in .js files using content from the
# corresponding .html files.
html_to_js("web_components") {
js_files = [ "cast_feedback_ui.js" ]
}