chromium/components/lens/BUILD.gn

# Copyright 2021 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/buildflag_header.gni")
import("//components/lens/features.gni")
import("//mojo/public/tools/bindings/mojom.gni")

# Generate a buildflag header for compile-time checking of Lens feature support.
buildflag_header("buildflags") {
  header = "buildflags.h"
  flags = [
    "ENABLE_LENS_DESKTOP=$enable_lens_desktop",
    "ENABLE_LENS_DESKTOP_GOOGLE_BRANDED_FEATURES=$enable_lens_desktop_google_branded_features",
  ]
}

static_library("lens") {
  sources = [
    "lens_constants.h",
    "lens_entrypoints.h",
    "lens_metadata.cc",
    "lens_metadata.h",
    "lens_metrics.cc",
    "lens_metrics.h",
    "lens_rendering_environment.h",
    "lens_testing_utils.cc",
    "lens_testing_utils.h",
    "lens_url_utils.cc",
    "lens_url_utils.h",
  ]
  deps = [
    "//base:base",
    "//components/lens:lens_mojo",
    "//components/lens/proto/v1:lens_latencies_metadata_proto",
    "//net",
    "//url",
  ]
  public_deps = [ ":features" ]
}

component("features") {
  output_name = "lens_features"

  defines = [ "IS_LENS_FEATURES_IMPL" ]

  sources = [
    "lens_features.cc",
    "lens_features.h",
  ]

  deps = [ "//base" ]
}

mojom("lens_mojo") {
  sources = [ "lens_metadata.mojom" ]

  deps = [
    "//mojo/public/mojom/base",
    "//ui/gfx/geometry/mojom",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "lens_url_utils_unittest.cc" ]

  deps = [
    ":lens",
    "//base",
    "//base/test:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]
}

source_set("enterprise_policy") {
  public = [ "lens_overlay_permission_utils.h" ]
  sources = [ "lens_overlay_permission_utils.cc" ]
  deps = [
    "//components/prefs",
    "//components/sync/service",
    "//components/sync_preferences",
    "//components/unified_consent",
  ]
}