chromium/device/bluetooth/public/mojom/BUILD.gn

# Copyright 2016 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")

mojom("mojom") {
  generate_java = true
  sources = [
    "gatt_characteristic_permissions.mojom",
    "gatt_characteristic_properties.mojom",
    "gatt_service_error_code.mojom",
    "uuid.mojom",
  ]
  webui_module_path = "/"

  # Indirect dependency of Blink test support so generate legacy bindings for
  # Blink in JavaScript.
  generate_legacy_js_bindings = true

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "bluetooth.mojom.UUID"
          cpp = "::device::BluetoothUUID"
        },
        {
          mojom = "bluetooth.mojom.GattCharacteristicProperties"
          cpp = "::device::BluetoothGattCharacteristic::Properties"
        },
        {
          mojom = "bluetooth.mojom.GattCharacteristicPermissions"
          cpp = "::device::BluetoothGattCharacteristic::Permissions"
        },
        {
          mojom = "bluetooth.mojom.GattServiceErrorCode"
          cpp = "::device::BluetoothGattService::GattErrorCode"
        },
      ]
      traits_headers = [
        "//device/bluetooth/public/mojom/uuid_mojom_traits.h",
        "//device/bluetooth/public/mojom/gatt_characteristic_mojom_traits.h",
        "//device/bluetooth/public/mojom/gatt_service_mojom_traits.h",
      ]
      traits_sources = [
        "//device/bluetooth/public/mojom/gatt_characteristic_mojom_traits.cc",
        "//device/bluetooth/public/mojom/gatt_service_mojom_traits.cc",
      ]
      traits_public_deps = [ "//device/bluetooth/public/cpp" ]
    },
  ]
}

mojom("fake_bluetooth_interfaces") {
  sources = [ "emulation/fake_bluetooth.mojom" ]

  public_deps = [ ":mojom" ]

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "bluetooth.mojom.ServiceDataMap"
          cpp = "::device::BluetoothDevice::ServiceDataMap"
        },
      ]
      traits_headers = [ "//device/bluetooth/public/mojom/emulation/fake_bluetooth_mojom_traits.h" ]
      traits_public_deps = [ "//device/bluetooth" ]
    },
  ]
}

# Experimental interfaces are not ready for production use yet. See README.md
mojom("deprecated_experimental_interfaces") {
  sources = [
    "adapter.mojom",
    "device.mojom",
  ]
  webui_module_path = "/"

  public_deps = [ ":mojom" ]

  visibility = [
    # Experimental interfaces are not ready for production use yet. See
    # README.md

    # Implementation of the mojom interfaces:
    "//device/bluetooth:deprecated_experimental_mojo",

    # Bluetooth internals page
    "//chrome/browser/ui/webui/bluetooth_internals:*",

    # Nearby Sharing feature
    "//chromeos/ash/services/nearby/public/mojom:*",

    # For device unittests
    "//device:*",
  ]
}