chromium/components/metrics/debug/BUILD.gn

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

import("//components/metrics/structured/buildflags/buildflags.gni")
import("//ui/webui/resources/tools/build_webui.gni")

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

  static_files = [ "metrics_internals.html" ]

  web_component_files = [
    "app.ts",
    "field_trials.ts",
  ]
  non_web_component_files = [
    "browser_proxy.ts",
    "log_utils.ts",
    "metrics_internals.ts",
  ]

  preprocessor_defines =
      [ "structured_metrics_enabled=$structured_metrics_debug_enabled" ]
  if (structured_metrics_debug_enabled) {
    static_files += [ "structured/structured_internals.html" ]

    web_component_files += [ "structured/app.ts" ]

    non_web_component_files += [
      "structured/structured_metrics_browser_proxy.ts",
      "structured/structured_utils.ts",
    ]
  }

  html_to_wrapper_template = "native"

  ts_composite = true
  ts_definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ]
  ts_deps = [
    "//ui/webui/resources/cr_elements:build_ts",
    "//ui/webui/resources/js:build_ts",
  ]

  webui_context_type = "trusted"
  grit_output_dir = "$root_gen_dir/components"
}

static_library("debug") {
  sources = [
    "metrics_internals_utils.cc",
    "metrics_internals_utils.h",
  ]

  deps = [
    "//base",
    "//components/metrics",
    "//components/metrics_services_manager",
    "//components/variations",
    "//components/variations/service",
  ]
}