chromium/ui/webui/resources/js/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("//build/config/chromeos/ui_mode.gni")
import("../tools/build_webui.gni")

include_polymer = !is_android && !is_ios

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

  non_web_component_files = [
    "action_link.ts",
    "assert.ts",
    "color_utils.ts",
    "cr.ts",
    "cr_router.ts",
    "custom_element.ts",
    "drag_wrapper.ts",
    "event_tracker.ts",
    "focus_grid.ts",
    "focus_outline_manager.ts",
    "focus_row.ts",
    "icon.ts",
    "keyboard_shortcut_list.ts",
    "load_time_data_deprecated.js",
    "load_time_data.ts",
    "metrics_reporter/browser_proxy.ts",
    "metrics_reporter/metrics_reporter.ts",
    "mojo_type_util.ts",
    "open_window_proxy.ts",
    "parse_html_subset.ts",
    "platform.ts",
    "plural_string_proxy.ts",
    "promise_resolver.ts",
    "search_highlight_utils.ts",
    "static_types.ts",
    "store.ts",
    "test_loader.ts",
    "test_loader_util.ts",
    "util.ts",
  ]

  if (is_chromeos) {
    non_web_component_files += [ "os_about.ts" ]
  }

  if (is_ios) {
    non_web_component_files += [
      "ios/mojo_api.js",
      "ios/web_ui.js",
    ]
  }

  if (is_chromeos_ash || is_ios) {
    # Used by ChromeOS UIs and ios inspect and omaha UIs
    non_web_component_files += [ "util_deprecated.js" ]
  }

  if (include_polymer) {
    non_web_component_files += [
      "focus_without_ink.ts",
      "browser_command/browser_command_proxy.ts",
    ]
  }

  mojo_files_deps = [ "./metrics_reporter:mojo_bindings_ts__generator" ]
  mojo_files = [ "$root_gen_dir/ui/webui/resources/js/metrics_reporter/metrics_reporter.mojom-webui.ts" ]

  if (include_polymer) {
    mojo_files_deps += [ "./browser_command:mojo_bindings_ts__generator" ]
    mojo_files += [ "$root_gen_dir/ui/webui/resources/js/browser_command/browser_command.mojom-webui.ts" ]
  }

  ts_out_dir = "$root_gen_dir/ui/webui/resources/tsc/js"
  ts_composite = true
  ts_deps = [ "../mojo:build_ts" ]
  ts_definitions = [
    "//tools/typescript/definitions/chrome_send.d.ts",
    "//tools/typescript/definitions/chrome_timeticks.d.ts",
  ]
  webui_context_type = "relative"
  generate_grdp = true
  grd_resource_path_prefix = rebase_path(".", "//ui/webui/resources")
}