chromium/chromeos/ash/services/ime/public/mojom/BUILD.gn

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

import("//build/config/chromeos/ui_mode.gni")
import("//mojo/public/tools/bindings/mojom.gni")

assert(is_chromeos_ash)

mojom("mojom") {
  sources = [
    "connection_factory.mojom",
    "ime_service.mojom",
    "input_engine.mojom",
    "input_method.mojom",
    "input_method_host.mojom",
    "input_method_user_data.mojom",
    "japanese_settings.mojom",
    "user_data_japanese_dictionary.mojom",
    "user_data_japanese_legacy_config.mojom",
  ]

  webui_module_path = "/"

  # Also used by targets that rely on legacy JavaScript bindings
  generate_legacy_js_bindings = true

  public_deps = [
    "//mojo/public/mojom/base",
    "//sandbox/policy/mojom",
    "//url/mojom:url_mojom_gurl",
  ]

  cpp_typemaps = [
    {
      types = [
        {
          mojom = "ash.ime.mojom.CompletionCandidate"
          cpp = "::ash::ime::DecoderCompletionCandidate"
        },
        {
          mojom = "ash.ime.mojom.SuggestionMode"
          cpp = "::ash::ime::AssistiveSuggestionMode"
        },
        {
          mojom = "ash.ime.mojom.SuggestionType"
          cpp = "::ash::ime::AssistiveSuggestionType"
        },
        {
          mojom = "ash.ime.mojom.SuggestionCandidate"
          cpp = "::ash::ime::AssistiveSuggestion"
        },
        {
          mojom = "ash.ime.mojom.SuggestionsTextContext"
          cpp = "::ash::ime::SuggestionsTextContext"
        },
        {
          mojom = "ash.ime.mojom.TextRange"
          cpp = "::gfx::Range"
        },
        {
          mojom = "ash.ime.mojom.AssistiveWindow"
          cpp = "::ash::ime::AssistiveWindow"
        },
        {
          mojom = "ash.ime.mojom.AssistiveWindowType"
          cpp = "::ash::ime::AssistiveWindowType"
        },
        {
          mojom = "ash.ime.mojom.AutocorrectSuggestionProvider"
          cpp = "::ash::ime::AutocorrectSuggestionProvider"
        },
        {
          mojom = "ash.ime.mojom.BucketedHistogram"
          cpp = "::base::Histogram*"
          copyable_pass_by_value = true
          nullable_is_same_type = true
        },
      ]

      traits_headers = [ "mojom_traits.h" ]
      traits_sources = [ "mojom_traits.cc" ]
      traits_public_deps = [
        "//base",
        "//chromeos/ash/services/ime/public/cpp:structs",
        "//ui/gfx/range",
      ]
    },
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "mojom_traits_unittest.cc" ]
  deps = [
    ":mojom",
    "//mojo/public/cpp/test_support:test_utils",
    "//testing/gmock",
    "//testing/gtest",
  ]
}