# 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("//mojo/public/tools/bindings/mojom.gni")

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

static_library("nearby_share") {
  sources = [
    "nearby_share_dialog_ui.cc",
    "nearby_share_dialog_ui.h",
    "shared_resources.cc",
    "shared_resources.h",
  ]

  public_deps = [ "//chrome/browser:browser_public_dependencies" ]

  deps = [
    "//chrome/browser/nearby_sharing",
    "//chrome/browser/nearby_sharing:share_target",
    "//chrome/browser/nearby_sharing/common",
    "//chrome/browser/nearby_sharing/contacts",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/resources/chromeos/nearby_share:resources",
    "//chrome/browser/sharesheet",
    "//chrome/browser/ui/navigator",
    "//chrome/browser/ui/webui",
    "//chrome/browser/ui/webui:metrics_handler",
    "//chrome/browser/ui/webui:plural_string_handler",
    "//chrome/browser/ui/webui:theme_source",
    "//chrome/browser/ui/webui/sanitized_image:sanitized_image_source",
    "//ui/webui",
  ]
}

source_set("browser_tests") {
  testonly = true

  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

  sources = [ "nearby_share_dialog_ui_browsertest.cc" ]

  deps = [
    ":nearby_share",
    "//chrome/browser",
    "//chrome/browser/nearby_sharing/common",
    "//chrome/browser/sharesheet",
    "//chrome/browser/ui",
    "//chrome/test:test_support_ui",
  ]
}

mojom("share_type") {
  sources = [ "nearby_share_share_type.mojom" ]
  webui_module_path = "/"
}

mojom("mojom") {
  sources = [ "nearby_share.mojom" ]

  public_deps = [
    ":share_type",
    "//chromeos/ash/services/nearby/public/mojom:nearby_share_settings",
    "//mojo/public/mojom/base",
    "//url/mojom:url_mojom_gurl",
  ]

  webui_module_path = "/"

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "nearby_share.mojom.ShareTarget"
          cpp = "::ShareTarget"
        },
      ]
      traits_headers = [ "nearby_share_mojom_traits.h" ]
      traits_sources = [ "nearby_share_mojom_traits.cc" ]
      traits_deps = [ "//chrome/browser/nearby_sharing:share_target" ]
    },
  ]
}
