blob: ff97df9501f251d7de2c98e2c904cf4df1a8b30f [file] [log] [blame]
# 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("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("../optimize_webui.gni")
if (optimize_webui) {
downloads_pak_file = "downloads_resources.pak"
unpak_folder = "downloads_resources.unpak"
optimize_webui("build") {
host = "downloads"
html_in_files = [ "downloads.html" ]
html_out_files = [ "vulcanized.html" ]
insert_in_head = "<base href=chrome://downloads>"
input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir)
js_out_files = [ "crisper.js" ]
excludes = [
"chrome://resources/js/mojo_bindings_lite.js",
"chrome://downloads/downloads.mojom-lite.js",
"chrome://downloads/downloads.mojom-lite.html",
]
replace_for_html_imports_polyfill = "crisper.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") {
deps = [
":browser_proxy",
":constants",
":downloads",
":item",
":manager",
":search_service",
":toolbar",
]
}
js_library("browser_proxy") {
deps = [
"//chrome/browser/ui/webui/downloads:mojo_bindings_js_library_for_compile",
"//ui/webui/resources/js:cr",
]
externs_list = [ "externs.js" ]
}
js_library("constants") {
deps = [
"//ui/webui/resources/js:cr",
]
}
js_library("downloads") {
deps = [
":manager",
"//ui/webui/resources/js:cr",
]
externs_list = [ "$externs_path/html_imports.js" ]
}
js_library("icon_loader") {
deps = [
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:icon",
]
}
js_library("item") {
deps = [
":browser_proxy",
":constants",
":icon_loader",
"//third_party/polymer/v1_0/components-chromium/paper-behaviors:paper-inky-focus-behavior-extracted",
"//ui/webui/resources/cr_elements/cr_toast:cr_toast_manager",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:util",
"//ui/webui/resources/js/cr/ui:focus_row",
"//ui/webui/resources/js/cr/ui:focus_row_behavior",
"//ui/webui/resources/js/cr/ui:focus_without_ink",
]
}
js_library("manager") {
deps = [
":browser_proxy",
":item",
":search_service",
":toolbar",
"//third_party/polymer/v1_0/components-chromium/iron-list:iron-list-extracted",
"//ui/webui/resources/cr_elements/cr_toast:cr_toast_manager",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:find_shortcut_behavior",
"//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:util",
"//ui/webui/resources/js/cr:ui",
"//ui/webui/resources/js/cr/ui:command",
]
externs_list = [ "$externs_path/chrome_send.js" ]
}
js_library("search_service") {
deps = [
":browser_proxy",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:load_time_data",
]
}
js_library("toolbar") {
deps = [
":browser_proxy",
":search_service",
"//third_party/polymer/v1_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer-extracted",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
"//ui/webui/resources/cr_elements/cr_toast:cr_toast_manager",
"//ui/webui/resources/cr_elements/cr_toolbar:cr_toolbar",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:util",
]
}