chromium/chromeos/components/cdm_factory_daemon/mojom/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("//mojo/public/tools/bindings/mojom.gni")

mojom_component("mojom") {
  sources = [
    "browser_cdm_factory.mojom",
    "cdm_factory_daemon.mojom",
    "cdm_storage.mojom",
    "content_decryption_module.mojom",
    "output_protection.mojom",
  ]

  public_deps = [
    "//mojo/public/mojom/base",
    "//sandbox/policy/mojom",
    "//ui/gfx/geometry/mojom",
  ]
  if (is_chromeos_ash) {
    public_deps += [
      "//ash/components/arc/mojom:oemcrypto",
      "//ash/components/arc/mojom:protected_buffer_manager",
    ]
  }

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "chromeos.cdm.mojom.CdmMessageType"
          cpp = "::media::CdmMessageType"
        },
        {
          mojom = "chromeos.cdm.mojom.CdmSessionType"
          cpp = "::media::CdmSessionType"
        },
        {
          mojom = "chromeos.cdm.mojom.EmeInitDataType"
          cpp = "::media::EmeInitDataType"
        },
        {
          mojom = "chromeos.cdm.mojom.HdcpVersion"
          cpp = "::media::HdcpVersion"
        },
        {
          mojom = "chromeos.cdm.mojom.PromiseException"
          cpp = "::media::CdmPromise::Exception"
        },
        {
          mojom = "chromeos.cdm.mojom.ProtectionType"
          cpp = "::display::ContentProtectionMethod"
        },
        {
          mojom = "chromeos.cdm.mojom.LinkType"
          cpp = "::display::DisplayConnectionType"
        },
      ]
      traits_headers = [ "cdm_types_enum_mojom_traits.h" ]
      traits_public_deps = [
        "//media",
        "//ui/display/types",
      ]
    },
    {
      types = [
        {
          mojom = "chromeos.cdm.mojom.CdmKeyStatus"
          cpp = "::media::CdmKeyInformation::KeyStatus"
        },
        {
          mojom = "chromeos.cdm.mojom.CdmKeyInformation"
          cpp = "::std::unique_ptr<::media::CdmKeyInformation>"
          move_only = true
        },
      ]
      traits_headers = [ "cdm_key_information_mojom_traits.h" ]
      traits_sources = [ "cdm_key_information_mojom_traits.cc" ]
      traits_public_deps = [ "//media" ]
    },
    {
      types = [
        {
          mojom = "chromeos.cdm.mojom.DecryptConfig"
          cpp = "::std::unique_ptr<::media::DecryptConfig>"
          move_only = true
          nullable_is_same_type = true
        },
        {
          mojom = "chromeos.cdm.mojom.DecryptStatus"
          cpp = "::media::Decryptor::Status"
        },
        {
          mojom = "chromeos.cdm.mojom.EncryptionPattern"
          cpp = "::media::EncryptionPattern"
        },
        {
          mojom = "chromeos.cdm.mojom.EncryptionScheme"
          cpp = "::media::EncryptionScheme"
        },
        {
          mojom = "chromeos.cdm.mojom.SubsampleEntry"
          cpp = "::media::SubsampleEntry"
        },
      ]
      traits_headers = [ "decrypt_config_mojom_traits.h" ]
      traits_sources = [ "decrypt_config_mojom_traits.cc" ]
      traits_public_deps = [ "//media" ]
    },
  ]

  output_prefix = "chromeos_cdm_mojom"
  macro_prefix = "CHROMEOS_CDM_MOJOM"
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "cdm_key_information_mojom_traits_unittest.cc",
    "decrypt_config_mojom_traits_unittest.cc",
  ]

  deps = [
    ":mojom",
    "//base",
    "//testing/gmock",
    "//testing/gtest",
  ]
}