chromium/chrome/browser/resources/downloads/BUILD.gn

# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//ui/webui/resources/tools/build_webui.gni")

assert(!is_android)

build_webui("build") {
  grd_prefix = "downloads"

  static_files = [
    "downloads.html",
    "images/incognito_marker.svg",
    "images/no_downloads.svg",
  ]

  # Files holding a Polymer element definition and have an equivalent .html file.
  web_component_files = [
    "item.ts",
    "manager.ts",
  ]

  non_web_component_files = [
    "browser_proxy.ts",
    "bypass_warning_confirmation_dialog.html.ts",
    "bypass_warning_confirmation_dialog.ts",
    "dangerous_download_interstitial.html.ts",
    "dangerous_download_interstitial.ts",
    "data.ts",
    "downloads.ts",
    "icon_loader.ts",
    "search_service.ts",
    "toolbar.html.ts",
    "toolbar.ts",
  ]

  css_files = [
    "bypass_warning_confirmation_dialog.css",
    "dangerous_download_interstitial.css",
    "toolbar.css",
  ]

  icons_html_files = [ "icons.html" ]

  if (is_chrome_branded) {
    icons_html_files += [ "internal/icons.html" ]
  }

  html_to_wrapper_template = "detect"

  mojo_files_deps =
      [ "//chrome/browser/ui/webui/downloads:mojo_bindings_ts__generator" ]
  mojo_files = [
    "$root_gen_dir/chrome/browser/ui/webui/downloads/downloads.mojom-webui.ts",
  ]

  ts_composite = true
  ts_definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ]
  ts_deps = [
    "//third_party/lit/v3_0:build_ts",
    "//third_party/polymer/v3_0:library",
    "//ui/webui/resources/cr_components/managed_footnote:build_ts",
    "//ui/webui/resources/cr_elements:build_ts",
    "//ui/webui/resources/js:build_ts",
    "//ui/webui/resources/mojo:build_ts",
  ]

  webui_context_type = "trusted"
  optimize = optimize_webui
  if (optimize) {
    optimize_webui_host = "downloads"
    optimize_webui_in_files = [ "downloads.js" ]
  }
}