# Copyright 2022 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/android/rules.gni")

source_set("public") {
  sources = [
    "touch_to_fill_autofill_controller.h",
    "touch_to_fill_autofill_view.h",
    "touch_to_fill_controller_base.h",
    "touch_to_fill_payment_method_controller.h",
    "touch_to_fill_payment_method_view.h",
    "touch_to_fill_payment_method_view_controller.h",
  ]

  deps = [ "//base" ]
}

source_set("android") {
  sources = [
    "touch_to_fill_autofill_view_impl.cc",
    "touch_to_fill_autofill_view_impl.h",
    "touch_to_fill_payment_method_view_impl.cc",
    "touch_to_fill_payment_method_view_impl.h",
  ]

  public_deps = [ "//base" ]

  deps = [
    ":public",
    "//chrome/android:chrome_jni_headers",
    "//chrome/browser/autofill",
    "//chrome/browser/profiles",
    "//chrome/browser/ui/autofill/payments",
    "//components/autofill/android:main_autofill_jni_headers",
    "//components/autofill/android:payments_autofill_cc",
    "//components/autofill/android:payments_jni_headers",
    "//components/autofill/core/common:features",
    "//content/public/browser",
    "//third_party/libaddressinput:util",
    "//ui/android",
  ]
}

source_set("impl") {
  sources = [
    "touch_to_fill_autofill_controller_impl.cc",
    "touch_to_fill_autofill_controller_impl.h",
    "touch_to_fill_autofill_delegate_android_impl.cc",
    "touch_to_fill_autofill_delegate_android_impl.h",
    "touch_to_fill_controller_base.cc",
    "touch_to_fill_payment_method_controller_impl.cc",
    "touch_to_fill_payment_method_controller_impl.h",
    "touch_to_fill_payment_method_delegate_android_impl.cc",
    "touch_to_fill_payment_method_delegate_android_impl.h",
  ]

  public_deps = [
    ":public",
    "//chrome/browser:browser_public_dependencies",
  ]

  deps = [
    ":android",
    "//base",
    "//chrome/android:chrome_jni_headers",
    "//chrome/browser/android:resource_mapper",
    "//chrome/browser/ui/android/tab_model",
    "//chrome/browser/ui/autofill",
    "//chrome/browser/ui/autofill/payments",
    "//components/affiliations/core/browser:affiliations",
    "//components/autofill/android:keyboard_suppressor",
    "//components/autofill/content/browser",
    "//components/autofill/core/browser",
    "//components/autofill/core/common",
    "//components/personal_context/first_run",
    "//content/public/browser",
    "//ui/android",
  ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "touch_to_fill_autofill_controller_impl_unittest.cc",
    "touch_to_fill_autofill_delegate_android_impl_unittest.cc",
    "touch_to_fill_payment_method_controller_impl_unittest.cc",
    "touch_to_fill_payment_method_delegate_android_impl_unittest.cc",
    "touch_to_fill_payment_method_quality_metrics_unittest.cc",
  ]

  deps = [
    ":impl",
    ":public",
    "//base",
    "//base/test:test_support",
    "//chrome/browser/ui/android/tab_model:test_support",
    "//chrome/browser/ui/autofill/payments",
    "//chrome/test:test_support",
    "//components/autofill/content/browser",
    "//components/autofill/content/browser:test_support",
    "//components/autofill/core/browser",
    "//components/autofill/core/browser:test_support",
    "//components/autofill/core/common",
    "//components/autofill/core/common:test_support",
    "//content/test:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

source_set("test_support") {
  testonly = true
  sources = [
    "mock_touch_to_fill_payment_method_controller.cc",
    "mock_touch_to_fill_payment_method_controller.h",
  ]

  public_deps = [
    ":public",
    "//base",
    "//components/autofill/core/browser:test_support",
  ]

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

android_library("public_java") {
  deps = [
    "//chrome/browser/autofill/android:java",
    "//chrome/browser/profiles/android:java",
    "//chrome/browser/touch_to_fill/common/android:java",
    "//components/browser_ui/bottomsheet/android:java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
    "//ui/android:ui_java",
  ]

  sources = [
    "java/src/org/chromium/chrome/browser/touch_to_fill/autofill/TouchToFillAutofillComponent.java",
    "java/src/org/chromium/chrome/browser/touch_to_fill/payments/TouchToFillPaymentMethodComponent.java",
  ]
}
