chromium/cc/mojom/BUILD.gn

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

component("shared_mojom_traits") {
  output_name = "cc_shared_mojom_traits"
  defines = [ "IS_CC_SHARED_MOJOM_TRAITS_IMPL" ]
  sources = [
    "render_frame_metadata_mojom_traits.cc",
    "render_frame_metadata_mojom_traits.h",
  ]
  public_deps = [
    ":mojom_shared",
    "//cc:cc",
    "//mojo/public/cpp/base:shared_typemap_traits",
    "//ui/gfx/geometry/mojom:mojom_traits",
  ]
}

mojom("mojom") {
  generate_java = true
  sources = [
    "browser_controls_offset_tags_info.mojom",
    "browser_controls_params.mojom",
    "browser_controls_state.mojom",
    "overscroll_behavior.mojom",
    "render_frame_metadata.mojom",
    "touch_action.mojom",
  ]

  enabled_features = []
  if (is_android || is_ios) {
    enabled_features += [ "is_android_or_ios" ]
  }

  public_deps = [
    "//mojo/public/mojom/base",
    "//services/viz/public/mojom",
    "//skia/public/mojom",
    "//ui/gfx/geometry/mojom",
  ]

  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"

  shared_typemap = [
    {
      types = [
        {
          mojom = "cc.mojom.BrowserControlsState"
          cpp = "::cc::BrowserControlsState"
        },
      ]
      traits_headers = [ "//cc/ipc/cc_param_traits_macros.h" ]
      traits_public_deps = [ "//cc/ipc" ]
    },
    {
      types = [
        {
          mojom = "cc.mojom.TouchAction"
          cpp = "::cc::TouchAction"
        },
      ]
      traits_headers = [ "//cc/ipc/cc_param_traits_macros.h" ]
      traits_public_deps = [ "//cc/ipc" ]
    },
    {
      types = [
        {
          mojom = "cc.mojom.OverscrollBehavior"
          cpp = "::cc::OverscrollBehavior"
        },
      ]
      traits_headers = [ "//cc/ipc/cc_param_traits_macros.h" ]
      traits_public_deps = [ "//cc/ipc" ]
    },
    {
      types = [
        {
          mojom = "cc.mojom.BrowserControlsParams"
          cpp = "::cc::BrowserControlsParams"
        },
      ]
      traits_headers = [ "//cc/ipc/cc_param_traits_macros.h" ]
      traits_public_deps = [ "//cc/ipc" ]
    },
    {
      types = [
        {
          mojom = "cc.mojom.BrowserControlsOffsetTagsInfo"
          cpp = "::cc::BrowserControlsOffsetTagsInfo"
        },
      ]
      traits_headers =
          [ "//cc/mojom/browser_controls_offset_tags_info_mojom_traits.h" ]
      traits_public_deps = [ "//components/viz/common" ]
    },
    {
      types = [
        {
          mojom = "cc.mojom.RenderFrameMetadata"
          cpp = "::cc::RenderFrameMetadata"
        },
      ]
      traits_headers = [ "//cc/mojom/render_frame_metadata_mojom_traits.h" ]
      traits_public_deps = [ ":shared_mojom_traits" ]
    },
  ]

  cpp_typemaps = shared_typemap
  blink_cpp_typemaps = shared_typemap
}

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

mojom("element_id") {
  generate_java = true
  sources = [ "element_id.mojom" ]
  cpp_typemaps = [
    {
      types = [
        {
          mojom = "cc.mojom.ElementId"
          cpp = "::cc::ElementId"
          nullable_is_same_type = true
          copyable_pass_by_value = true
        },
      ]
      traits_headers = [ "element_id_mojom_traits.h" ]
      traits_public_deps = [ "//cc/paint" ]
    },
  ]
}