chromium/media/mojo/mojom/BUILD.gn

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

import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")

mojom("mojom") {
  generate_java = true

  # TODO(crbug.com/40499115): Conditionally add source files in this list when we
  # support EnabledIf attribute in mojom files.
  sources = [
    "audio_data_pipe.mojom",
    "audio_decoder.mojom",
    "audio_encoder.mojom",
    "audio_input_stream.mojom",
    "audio_logging.mojom",
    "audio_output_stream.mojom",
    "audio_parameters.mojom",
    "audio_processing.mojom",
    "audio_stream_factory.mojom",
    "capture_handle.mojom",
    "cdm_document_service.mojom",
    "cdm_service.mojom",
    "cdm_storage.mojom",
    "content_decryption_module.mojom",
    "decryptor.mojom",
    "demuxer_stream.mojom",
    "display_media_information.mojom",
    "frame_interface_factory.mojom",
    "interface_factory.mojom",
    "key_system_support.mojom",
    "media_log.mojom",
    "media_metrics_provider.mojom",
    "media_player.mojom",
    "media_service.mojom",
    "media_types.mojom",
    "output_protection.mojom",
    "playback_events_recorder.mojom",
    "provision_fetcher.mojom",
    "renderer.mojom",
    "renderer_extensions.mojom",
    "video_decode_perf_history.mojom",
    "video_decode_stats_recorder.mojom",
    "video_decoder.mojom",
    "video_encode_accelerator.mojom",
    "video_encoder_info.mojom",
    "video_encoder_metrics_provider.mojom",
    "watch_time_recorder.mojom",
    "webrtc_video_perf.mojom",
  ]

  if (enable_media_drm_storage) {
    sources += [ "media_drm_storage.mojom" ]
  }

  if (is_android) {
    sources += [
      "android_overlay.mojom",
      "mediadrm_support.mojom",
    ]
  } else {
    sources += [ "speech_recognition_service.mojom" ]
  }

  # TODO(crbug.com/1293520): Revisit this after the cast renderer has been
  # deprecated and removed.
  if (is_castos || is_cast_android) {
    sources += [ "cast_application_media_info_manager.mojom" ]
  }

  if (is_win) {
    sources += [
      "dcomp_surface_registry.mojom",
      "media_foundation_preferences.mojom",
      "media_foundation_service.mojom",
    ]
  }

  public_deps = [
    ":audio_data",
    ":encryption_pattern",
    ":speech_recognition",
    ":web_speech_recognition",
    "//gpu/ipc/common:interfaces",
    "//media/learning/mojo/public/mojom",
    "//media/mojo/mojom/stable:stable_video_decoder",
    "//mojo/public/mojom/base",
    "//sandbox/policy/mojom",
    "//services/media_session/public/mojom",
    "//services/network/public/mojom",
    "//services/network/public/mojom:cookies_mojom",
    "//services/network/public/mojom:mojom_storage_access_api",
    "//services/service_manager/public/mojom",
    "//services/viz/public/mojom:shared_image_format",
    "//ui/gfx/geometry/mojom",
    "//ui/gfx/mojom",
    "//ui/gfx/mojom:hdr_metadata",
    "//ui/gl/mojom",
    "//url/mojom:url_mojom_gurl",
    "//url/mojom:url_mojom_origin",
  ]

  if (is_mac) {
    # TODO(xhwang): Ideally media should not worry about sandbox. Find a way to
    # remove this dependency.
    public_deps += [ "//sandbox/mac/mojom" ]
  }

  enabled_features = []
  if (is_linux || is_chromeos) {
    enabled_features += [ "is_linux_or_chromeos" ]
  }

  if (allow_oop_video_decoder) {
    enabled_features += [ "allow_oop_video_decoder" ]
  }

  # Help select ServiceSandbox for media_service.mojom.
  if (mojo_media_host == "browser") {
    enabled_features += [ "mojo_media_in_browser" ]
  } else if (mojo_media_host == "gpu") {
    enabled_features += [ "mojo_media_in_gpu" ]
  } else if (mojo_media_host == "") {
    enabled_features += [ "mojo_media_service_unused" ]
  } else {
    assert(false, "Invalid mojo media host: $mojo_media_host")
  }

  if (enable_cast_renderer) {
    enabled_features += [ "enable_cast_renderer" ]
  }

  shared_typemaps = [
    {
      types = [
        {
          mojom = "media.mojom.AudioParameters"
          cpp = "::media::AudioParameters"
        },
      ]
      traits_headers = [ "//media/base/ipc/media_param_traits.h" ]
      traits_public_deps = [
        "//media",
        "//media/base/ipc",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.AudioProcessingSettings"
          cpp = "::media::AudioProcessingSettings"
        },
        {
          mojom = "media.mojom.AudioProcessingStats"
          cpp = "::media::AudioProcessingStats"
        },
      ]
      traits_headers = [ "audio_processing_mojom_traits.h" ]
      traits_public_deps = [ ":shared_mojom_traits" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.FullscreenVideoStatus"
          cpp = "::blink::WebFullscreenVideoStatus"
        },
      ]
      traits_headers = [ "//media/base/ipc/media_param_traits_macros.h" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.MediaContentType"
          cpp = "::media::MediaContentType"
        },
      ]
      traits_headers = [ "//media/base/ipc/media_param_traits_macros.h" ]
      traits_public_deps = [
        "//base",
        "//media",
        "//media/base/ipc",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.VideoFrameMetadata"
          cpp = "::media::VideoFrameMetadata"
        },
      ]
      traits_headers = [ "video_frame_metadata_mojom_traits.h" ]
      traits_public_deps = [ ":shared_mojom_traits" ]
    },
  ]

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "media.mojom.AudioDecoderConfig"
          cpp = "::media::AudioDecoderConfig"
        },
        {
          mojom = "media.mojom.AudioDecoderType"
          cpp = "::media::AudioDecoderType"
        },
      ]
      traits_headers = [ "audio_decoder_config_mojom_traits.h" ]
      traits_sources = [ "audio_decoder_config_mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//media",
        "//media/base/ipc",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.AudioEncoderConfig"
          cpp = "::media::AudioEncoder::Options"
        },
      ]
      traits_headers = [ "audio_encoder_config_mojom_traits.h" ]
      traits_sources = [ "audio_encoder_config_mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//media",
        "//media/base/ipc",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.EncodedAudioBuffer"
          cpp = "::media::EncodedAudioBuffer"
          move_only = true
        },
      ]
      traits_headers = [ "encoded_audio_buffer_traits.h" ]
      traits_sources = [ "encoded_audio_buffer_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//media",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.CdmKeyInformation"
          cpp = "::std::unique_ptr<::media::CdmKeyInformation>"
          move_only = true
        },
        {
          mojom = "media.mojom.CdmKeyStatus"
          cpp = "::media::CdmKeyInformation::KeyStatus"
        },
      ]
      traits_headers = [ "cdm_key_information_mojom_traits.h" ]
      traits_sources = [ "cdm_key_information_mojom_traits.cc" ]
      traits_public_deps = [ "//media" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.VideoRotation"
          cpp = "::media::VideoRotation"
        },
        {
          mojom = "media.mojom.VideoTransformation"
          cpp = "::media::VideoTransformation"
        },
      ]
      traits_headers = [ "video_transformation_mojom_traits.h" ]
      traits_sources = [ "video_transformation_mojom_traits.cc" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.CdmConfig"
          cpp = "::media::CdmConfig"
        },
        {
          mojom = "media.mojom.CdmPromiseResult.Exception"
          cpp = "::media::CdmPromise::Exception"
        },
        {
          mojom = "media.mojom.CdmSessionType"
          cpp = "::media::CdmSessionType"
        },
        {
          mojom = "media.mojom.CdmMessageType"
          cpp = "::media::CdmMessageType"
        },
        {
          mojom = "media.mojom.Decryptor.Status"
          cpp = "::media::Decryptor::Status"
        },
        {
          mojom = "media.mojom.Decryptor.StreamType"
          cpp = "::media::Decryptor::StreamType"
        },
        {
          mojom = "media.mojom.DemuxerStream.Status"
          cpp = "::media::DemuxerStream::Status"
        },
        {
          mojom = "media.mojom.DemuxerStream.Type"
          cpp = "::media::DemuxerStream::Type"
        },
        {
          mojom = "media.mojom.EmeInitDataType"
          cpp = "::media::EmeInitDataType"
        },
        {
          mojom = "media.mojom.HdcpVersion"
          cpp = "::media::HdcpVersion"
        },
        {
          mojom = "media.mojom.SessionData.KeyType"
          cpp = "::media::MediaDrmKeyType"
        },
      ]
      traits_headers = [ "//media/base/ipc/media_param_traits_macros.h" ]
      traits_public_deps = [
        "//media",
        "//media/base/ipc",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.PipelineStatistics"
          cpp = "::media::PipelineStatistics"
        },
        {
          mojom = "media.mojom.AudioPipelineInfo"
          cpp = "::media::AudioPipelineInfo"
        },
        {
          mojom = "media.mojom.VideoPipelineInfo"
          cpp = "::media::VideoPipelineInfo"
        },
        {
          mojom = "media.mojom.AudioDecoderType"
          cpp = "::media::AudioDecoderType"
        },
        {
          mojom = "media.mojom.VideoDecoderType"
          cpp = "::media::VideoDecoderType"
        },
      ]
      traits_headers = [ "pipeline_status_mojom_traits.h" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.StatusData"
          cpp = "::media::internal::StatusData"
        },
        {
          mojom = "media.mojom.EncoderStatus"
          cpp = "::media::EncoderStatus"
        },
        {
          mojom = "media.mojom.DecoderStatus"
          cpp = "::media::DecoderStatus"
        },
        {
          mojom = "media.mojom.PipelineStatus"
          cpp = "::media::PipelineStatus"
        },
      ]
      traits_headers = [ "status_mojom_traits.h" ]
      traits_sources = [ "status_mojom_traits.cc" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.VideoAspectRatio"
          cpp = "::media::VideoAspectRatio"
        },
      ]
      traits_headers = [ "video_aspect_ratio_mojom_traits.h" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.VideoColorSpace.PrimaryID"
          cpp = "::media::VideoColorSpace::PrimaryID"
        },
        {
          mojom = "media.mojom.VideoColorSpace.TransferID"
          cpp = "::media::VideoColorSpace::TransferID"
        },
        {
          mojom = "media.mojom.VideoColorSpace.MatrixID"
          cpp = "::media::VideoColorSpace::MatrixID"
        },
        {
          mojom = "media.mojom.VideoColorSpace.RangeID"
          cpp = "::gfx::ColorSpace::RangeID"
        },
        {
          mojom = "media.mojom.VideoColorSpace"
          cpp = "::media::VideoColorSpace"
        },
      ]
      traits_headers = [ "video_color_space_mojom_traits.h" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.OverlayInfo"
          cpp = "::media::OverlayInfo"
        },
        {
          mojom = "media.mojom.SupportedVideoDecoderConfig"
          cpp = "::media::SupportedVideoDecoderConfig"
        },
        {
          mojom = "media.mojom.VideoDecoderType"
          cpp = "::media::VideoDecoderType"
        },
      ]
      traits_headers = [
        "supported_video_decoder_config_mojom_traits.h",
        "//media/base/ipc/media_param_traits_macros.h",
      ]
      traits_sources = [ "supported_video_decoder_config_mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//media",
        "//media/base/ipc",
        "//media/gpu/ipc/common",
        "//ui/gfx/geometry/mojom:mojom_traits",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.VideoDecoderConfig"
          cpp = "::media::VideoDecoderConfig"
        },
      ]
      traits_headers = [ "//media/base/video_decoder_config.h" ]
      traits_private_headers = [ "video_decoder_config_mojom_traits.h" ]
      traits_sources = [ "video_decoder_config_mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//media",
        "//media/base/ipc",
        "//ui/gfx/geometry/mojom:mojom_traits",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.SupportedAudioDecoderConfig"
          cpp = "::media::SupportedAudioDecoderConfig"
        },
      ]
      traits_headers = [ "supported_audio_decoder_config_mojom_traits.h" ]
      traits_sources = [ "supported_audio_decoder_config_mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//media",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.BitstreamBufferMetadata"
          cpp = "::media::BitstreamBufferMetadata"
        },
        {
          mojom = "media.mojom.VideoBitrateAllocation"
          cpp = "::media::VideoBitrateAllocation"
        },
        {
          mojom = "media.mojom.VideoEncodeAccelerator.Error"
          cpp = "::media::VideoEncodeAccelerator::Error"
        },
        {
          mojom = "media.mojom.VideoEncodeOptions"
          cpp = "::media::VideoEncoder::EncodeOptions"
        },
        {
          mojom = "media.mojom.VideoEncodeAcceleratorConfig"
          cpp = "::media::VideoEncodeAccelerator::Config"
        },
        {
          mojom = "media.mojom.SVCInterLayerPredMode"
          cpp = "::media::SVCInterLayerPredMode"
        },
        {
          mojom = "media.mojom.SpatialLayer"
          cpp = "::media::VideoEncodeAccelerator::Config::SpatialLayer"
        },
        {
          mojom = "media.mojom.SVCScalabilityMode"
          cpp = "::media::SVCScalabilityMode"
        },
        {
          mojom = "media.mojom.VariableBitrate"
          cpp = "::media::Bitrate"
        },
        {
          mojom = "media.mojom.ConstantBitrate"
          cpp = "::media::Bitrate"
        },
        {
          mojom = "media.mojom.Bitrate"
          cpp = "::media::Bitrate"
        },
        {
          mojom = "media.mojom.VideoEncodeAcceleratorSupportedProfile"
          cpp = "::media::VideoEncodeAccelerator::SupportedProfile"
        },
        {
          mojom = "media.mojom.Vp8Metadata"
          cpp = "::media::Vp8Metadata"
        },
        {
          mojom = "media.mojom.Vp9Metadata"
          cpp = "::media::Vp9Metadata"
        },
      ]
      traits_headers = [ "video_encode_accelerator_mojom_traits.h" ]
      traits_sources = [ "video_encode_accelerator_mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//media",
        "//media/base/ipc",
        "//ui/gfx/geometry/mojom:mojom_traits",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.ResolutionBitrateLimit"
          cpp = "::media::ResolutionBitrateLimit"
        },
        {
          mojom = "media.mojom.VideoEncoderInfo"
          cpp = "::media::VideoEncoderInfo"
        },
      ]
      traits_headers = [ "video_encoder_info_mojom_traits.h" ]
      traits_sources = [ "video_encoder_info_mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//media",
        "//media/base/ipc",
        "//ui/gfx/geometry/mojom:mojom_traits",
      ]
    },
    {
      types = [
        {
          mojom = "media.mojom.AudioCodec"
          cpp = "::media::AudioCodec"
        },
        {
          mojom = "media.mojom.AudioCodecProfile"
          cpp = "::media::AudioCodecProfile"
        },
        {
          mojom = "media.mojom.BufferingState"
          cpp = "::media::BufferingState"
        },
        {
          mojom = "media.mojom.BufferingStateChangeReason"
          cpp = "::media::BufferingStateChangeReason"
        },
        {
          mojom = "media.mojom.ChannelLayout"
          cpp = "::media::ChannelLayout"
        },
        {
          mojom = "media.mojom.DecodeStatus"
          cpp = "::media::DecodeStatus"
        },
        {
          mojom = "media.mojom.EncryptionScheme"
          cpp = "::media::EncryptionScheme"
        },
        {
          mojom = "media.mojom.MediaContainerName"
          cpp = "::media::container_names::MediaContainerName"
        },
        {
          mojom = "media.mojom.MediaLogRecord"
          cpp = "::media::MediaLogRecord"
        },
        {
          mojom = "media.mojom.OutputDeviceStatus"
          cpp = "::media::OutputDeviceStatus"
        },
        {
          mojom = "media.mojom.PipelineStatus"
          cpp = "::media::PipelineStatus"
        },
        {
          mojom = "media.mojom.SampleFormat"
          cpp = "::media::SampleFormat"
        },
        {
          mojom = "media.mojom.SubsampleEntry"
          cpp = "::media::SubsampleEntry"
        },
        {
          mojom = "media.mojom.VideoCodec"
          cpp = "::media::VideoCodec"
        },
        {
          mojom = "media.mojom.VideoCodecProfile"
          cpp = "::media::VideoCodecProfile"
        },
        {
          mojom = "media.mojom.VideoPixelFormat"
          cpp = "::media::VideoPixelFormat"
        },
        {
          mojom = "media.mojom.WaitingReason"
          cpp = "::media::WaitingReason"
        },
        {
          mojom = "media.mojom.WatchTimeKey"
          cpp = "::media::WatchTimeKey"
        },
        {
          mojom = "media.mojom.MediaStatusState"
          cpp = "::media::MediaStatus::State"
        },
        {
          mojom = "media.mojom.StatusCode"
          cpp = "::media::StatusCode"
        },
      ]
      traits_headers = [ "//media/base/ipc/media_param_traits_macros.h" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.VideoFrame"
          cpp = "::scoped_refptr<::media::VideoFrame>"
          nullable_is_same_type = true
        },
      ]
      traits_headers = [ "video_frame_mojom_traits.h" ]
      traits_sources = [ "video_frame_mojom_traits.cc" ]
      traits_public_deps = [ "//ui/gfx/geometry/mojom" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.CdmCapability"
          cpp = "::media::CdmCapability"
        },
      ]
      traits_headers = [ "cdm_capability_mojom_traits.h" ]
      traits_sources = [ "cdm_capability_mojom_traits.cc" ]
      traits_public_deps = [ "//media" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.KeySystemCapability"
          cpp = "::media::KeySystemCapability"
        },
      ]
      traits_headers = [ "key_system_capability_mojom_traits.h" ]
      traits_sources = [ "key_system_capability_mojom_traits.cc" ]
      traits_public_deps = [ "//media" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.CdmSessionClosedReason"
          cpp = "::media::CdmSessionClosedReason"
        },
      ]
      traits_headers = [ "media_types_enum_mojom_traits.h" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.RendererType"
          cpp = "::media::RendererType"
        },
      ]
      traits_headers = [ "media_types_enum_mojom_traits.h" ]
    },
    {
      types = [
        {
          mojom = "media.mojom.CreateCdmStatus"
          cpp = "::media::CreateCdmStatus"
        },
      ]
      traits_headers = [ "media_types_enum_mojom_traits.h" ]
    },
  ]

  if (is_win) {
    cpp_typemaps += [
      {
        types = [
          {
            mojom = "media.mojom.CdmEvent"
            cpp = "::media::CdmEvent"
          },
        ]
        traits_headers = [ "media_types_enum_mojom_traits.h" ]
      },
      {
        types = [
          {
            mojom = "media.mojom.MediaFoundationCdmData"
            cpp = "::std::unique_ptr<::media::MediaFoundationCdmData>"
            move_only = true
          },
        ]
        traits_headers = [ "media_foundation_cdm_data_mojom_traits.h" ]
        traits_sources = [ "media_foundation_cdm_data_mojom_traits.cc" ]
        traits_public_deps = [ "//media" ]
      },
      {
        types = [
          {
            mojom = "media.mojom.MediaFoundationRenderingMode"
            cpp = "::media::MediaFoundationRenderingMode"
          },
        ]
        traits_headers = [ "media_foundation_rendering_mode_mojom_traits.h" ]
        traits_public_deps = [ "//media" ]
      },
    ]
  }

  if (is_fuchsia) {
    sources += [ "fuchsia_media.mojom" ]

    shared_typemaps += [
      {
        types = [
          {
            mojom = "media.mojom.CdmRequest"
            cpp = "::fidl::InterfaceRequest<::fuchsia::media::drm::ContentDecryptionModule>"
            move_only = true
          },
          {
            mojom = "media.mojom.StreamProcessorRequest"
            cpp = "::fidl::InterfaceRequest<::fuchsia::media::StreamProcessor>"
            move_only = true
          },
        ]
        traits_headers = [ "fuchsia_media_mojom_traits.h" ]
        traits_public_deps = [
          "//mojo/public/cpp/base/fuchsia:traits",
          "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.media:fuchsia.media_hlcpp",
          "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.media.drm:fuchsia.media.drm_hlcpp",
        ]
      },
    ]
  }

  cpp_typemaps += shared_typemaps
  blink_cpp_typemaps = shared_typemaps

  export_class_attribute_blink = "BLINK_PLATFORM_EXPORT"
  export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
  export_header_blink = "third_party/blink/public/platform/web_common.h"
}

mojom("audio_data") {
  generate_java = true
  sources = [ "audio_data.mojom" ]
}

mojom("encryption_pattern") {
  generate_java = true
  sources = [ "encryption_pattern.mojom" ]
  cpp_typemaps = [
    {
      types = [
        {
          mojom = "media.mojom.EncryptionPattern"
          cpp = "::media::EncryptionPattern"
        },
      ]
      traits_headers = [ "encryption_pattern_mojom_traits.h" ]
      traits_sources = [ "encryption_pattern_mojom_traits.cc" ]
      traits_public_deps = [
        "//media",
        "//media/base/ipc",
      ]
    },
  ]
}

mojom("speech_recognition_audio_forwarder") {
  generate_java = true
  sources = [ "speech_recognition_audio_forwarder.mojom" ]
  public_deps = [ ":audio_data" ]
}

# Speech recognition API used between renderer/browser/service and between
# LaCrOS/Ash.
mojom("speech_recognition") {
  generate_java = true
  sources = [ "speech_recognition.mojom" ]
  cpp_typemaps = [
    {
      types = [
        {
          mojom = "media.mojom.HypothesisParts"
          cpp = "::media::HypothesisParts"
        },
        {
          mojom = "media.mojom.TimingInformation"
          cpp = "::media::TimingInformation"
        },
        {
          mojom = "media.mojom.SpeechRecognitionResult"
          cpp = "::media::SpeechRecognitionResult"
        },
      ]
      traits_headers = [
        "speech_recognition_result_mojom_traits.h",
        "speech_recognition_result.h",
      ]
      traits_sources = [
        "speech_recognition_result.cc",
        "speech_recognition_result_mojom_traits.cc",
      ]
      traits_public_deps = [ "//base" ]
    },
  ]
  public_deps = [
    ":audio_data",
    ":speech_recognition_audio_forwarder",
    ":web_speech_recognition",
    "//mojo/public/mojom/base",
    "//sandbox/policy/mojom",
    "//ui/gfx/geometry/mojom",
  ]
}

source_set("shared_mojom_traits") {
  sources = [
    "audio_processing_mojom_traits.cc",
    "audio_processing_mojom_traits.h",
    "video_frame_metadata_mojom_traits.cc",
    "video_frame_metadata_mojom_traits.h",
  ]

  public_deps = [
    ":mojom_shared",
    "//gpu/ipc/common",
    "//media",
    "//media/base/ipc:ipc",
    "//mojo/public/mojom/base",
    "//ui/gfx/geometry/mojom:mojom_traits",
  ]
}

mojom("remoting_common") {
  sources = [ "remoting_common.mojom" ]
}

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

  public_deps = [
    ":mojom",
    ":remoting_common",
  ]
}

mojom("test_interfaces") {
  testonly = true
  sources = [ "traits_test_service.mojom" ]
  public_deps = [ ":mojom" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "audio_decoder_config_mojom_traits_unittest.cc",
    "audio_processing_mojom_traits_unittest.cc",
    "cdm_key_information_mojom_traits_unittest.cc",
    "video_decoder_config_mojom_traits_unittest.cc",
    "video_encode_accelerator_mojom_traits_unittest.cc",
    "video_frame_metadata_mojom_traits_unittest.cc",
    "video_frame_mojom_traits_unittest.cc",
  ]

  if (!is_android) {
    sources += [ "speech_recognition_result_mojom_traits_unittest.cc" ]
  }

  deps = [
    ":speech_recognition",
    "//base",
    "//base/test:test_support",
    "//media:test_support",
    "//media/mojo:test_support",
    "//mojo/public/cpp/test_support:test_utils",
    "//testing/gmock",
    "//testing/gtest",
    "//ui/gfx:test_support",
  ]
}

mojom("web_speech_recognition") {
  generate_java = true

  sources = [
    "speech_recognition_error.mojom",
    "speech_recognition_error_code.mojom",
    "speech_recognition_grammar.mojom",
    "speech_recognition_result.mojom",
    "speech_recognizer.mojom",
  ]

  deps = [
    ":speech_recognition_audio_forwarder",
    "//mojo/public/mojom/base",
    "//url/mojom:url_mojom_gurl",
  ]

  export_class_attribute_blink = "BLINK_PLATFORM_EXPORT"
  export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
  export_header_blink = "third_party/blink/public/platform/web_common.h"
}