chromium/chrome/browser/resources/nearby_share/shared/BUILD.gn

# Copyright 2020 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")
import("//ui/webui/resources/tools/generate_grd.gni")

assert(is_chromeos, "Nearby Share is CrOS only")

# TODO(b/207087930) Consider moving these shared files to chrome://resources.
# b/207087942 provides context why chrome://resources did not work previously.
build_webui("build") {
  grd_prefix = "nearby_share"
  grd_resource_path_prefix = "shared"

  web_component_files = [
    "nearby_contact_visibility.ts",
    "nearby_device_icon.ts",
    "nearby_device.ts",
    "nearby_onboarding_one_page.ts",
    "nearby_onboarding_page.ts",
    "nearby_page_template.ts",
    "nearby_preview.ts",
    "nearby_progress.ts",
    "nearby_visibility_page.ts",
  ]

  non_web_component_files = [
    "nearby_contact_manager.ts",
    "nearby_metrics_logger.ts",
    "nearby_share_settings_mixin.ts",
    "nearby_share_settings.ts",
    "types.ts",
  ]

  icons_html_files = [
    "nearby_shared_icons.html",
    "nearby_shared_share_type_icons.html",
  ]

  mojo_files_deps = [
    "//chrome/browser/ui/webui/nearby_share:mojom_ts__generator",
    "//chrome/browser/ui/webui/nearby_share:share_type_ts__generator",
  ]
  mojo_files = [
    "$root_gen_dir/chrome/browser/ui/webui/nearby_share/nearby_share.mojom-webui.ts",
    "$root_gen_dir/chrome/browser/ui/webui/nearby_share/nearby_share_share_type.mojom-webui.ts",
  ]

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

  generate_grdp = true

  webui_context_type = "trusted"
}

# Grdp of JSON files for OS Settings.
generate_grd("build_json_grdp") {
  grd_prefix = "nearby_share"
  out_grd = "$target_gen_dir/nearby_share_json_resources.grdp"
  input_files_base_dir = rebase_path(".", "//")
  input_files = [
    "nearby_share_progress_bar.json",
    "nearby_share_pulse_animation.json",
  ]
}