chromium/ui/gfx/image/mojom/BUILD.gn

# Copyright 2017 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 = [ "image.mojom" ]

  webui_module_path = "chrome://resources/mojo/ui/gfx/image/mojom"

  # Used by content/common so need legacy JS bindings for Blink.
  generate_legacy_js_bindings = true

  public_deps = [ "//skia/public/mojom" ]

  shared_cpp_typemap = {
    types = [
      {
        mojom = "gfx.mojom.ImageSkia"
        cpp = "::gfx::ImageSkia"
        nullable_is_same_type = true
      },
      {
        mojom = "gfx.mojom.ImageSkiaRep"
        cpp = "::gfx::ImageSkiaRep"
      },
    ]
    traits_headers = [ "image_skia_mojom_traits.h" ]
    traits_public_deps = [ ":mojom_traits" ]
  }

  cpp_typemaps = [ shared_cpp_typemap ]
  blink_cpp_typemaps = [ shared_cpp_typemap ]
}

source_set("mojom_traits") {
  sources = [
    "image_skia_mojom_traits.cc",
    "image_skia_mojom_traits.h",
  ]

  public_deps = [
    ":mojom_shared_cpp_sources",
    "//skia/public/mojom",
    "//ui/gfx",
  ]
}

# Using a test service because the traits need to pass handles around. Revisit
# this after Deserialize(Serialize()) API works with handles.
mojom("test_interfaces") {
  sources = [ "image_traits_test_service.mojom" ]

  public_deps = [ ":mojom" ]
}

source_set("unit_test") {
  testonly = true

  sources = [ "image_traits_unittest.cc" ]

  deps = [
    ":mojom_traits",
    ":test_interfaces",
    "//base",
    "//base/test:test_support",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/test_support:test_utils",
    "//testing/gtest",
    "//ui/gfx:test_support",
  ]
}