chromium/components/infobars/android/BUILD.gn

# Copyright 2020 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")
import("//third_party/jni_zero/jni_zero.gni")

android_resources("java_resources") {
  sources = [
    "res/drawable-hdpi/infobar_shadow_left.9.png",
    "res/drawable-hdpi/infobar_shadow_top.png",
    "res/drawable-mdpi/infobar_shadow_left.9.png",
    "res/drawable-mdpi/infobar_shadow_top.png",
    "res/drawable-xhdpi/infobar_shadow_left.9.png",
    "res/drawable-xhdpi/infobar_shadow_top.png",
    "res/drawable-xxhdpi/infobar_shadow_left.9.png",
    "res/drawable-xxhdpi/infobar_shadow_top.png",
    "res/drawable-xxxhdpi/infobar_shadow_left.9.png",
    "res/drawable-xxxhdpi/infobar_shadow_top.png",
    "res/drawable/infobar_wrapper_bg.xml",
    "res/layout/infobar_control_icon_with_description.xml",
    "res/layout/infobar_control_icon_with_title.xml",
    "res/layout/infobar_control_message.xml",
    "res/layout/infobar_control_spinner.xml",
    "res/layout/infobar_control_spinner_drop_down.xml",
    "res/layout/infobar_control_spinner_view.xml",
    "res/layout/infobar_control_toggle.xml",
    "res/values-night/dimens.xml",
    "res/values/dimens.xml",
    "res/values/ids.xml",
  ]
  deps = [
    "//components/browser_ui/strings/android:browser_ui_strings_grd",
    "//components/browser_ui/widget/android:java_resources",
    "//components/strings",
    "//ui/android:ui_java_resources",
  ]
}

static_library("android") {
  sources = [
    "confirm_infobar.cc",
    "confirm_infobar.h",
    "infobar_android.cc",
    "infobar_android.h",
  ]

  deps = [
    ":jni_headers",
    "//base",
    "//components/infobars/core",
    "//ui/gfx",
  ]
}

android_library("java") {
  srcjar_deps = [ ":jni_headers" ]
  sources = [
    "java/src/org/chromium/components/infobars/ConfirmInfoBar.java",
    "java/src/org/chromium/components/infobars/InfoBar.java",
    "java/src/org/chromium/components/infobars/InfoBarAnimationListener.java",
    "java/src/org/chromium/components/infobars/InfoBarCompactLayout.java",
    "java/src/org/chromium/components/infobars/InfoBarContainerLayout.java",
    "java/src/org/chromium/components/infobars/InfoBarControlLayout.java",
    "java/src/org/chromium/components/infobars/InfoBarInteractionHandler.java",
    "java/src/org/chromium/components/infobars/InfoBarLayout.java",
    "java/src/org/chromium/components/infobars/InfoBarMessageView.java",
    "java/src/org/chromium/components/infobars/InfoBarUiItem.java",
    "java/src/org/chromium/components/infobars/InfoBarWrapper.java",
  ]
  deps = [
    ":infobar_android_enums_java",
    ":java_resources",
    "//base:base_java",
    "//build/android:build_java",
    "//components/browser_ui/styles/android:java",
    "//components/browser_ui/widget/android:java",
    "//components/infobars/core:infobar_enums_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/androidx:androidx_appcompat_appcompat_java",
    "//third_party/androidx:androidx_appcompat_appcompat_resources_java",
    "//third_party/androidx:androidx_core_core_java",
    "//third_party/jni_zero:jni_zero_java",
    "//ui/android:ui_java",
  ]

  resources_package = "org.chromium.components.infobars"
}

java_cpp_enum("infobar_android_enums") {
  sources = [ "infobar_android.h" ]
}

android_library("infobar_android_enums_java") {
  deps = [ "//third_party/androidx:androidx_annotation_annotation_java" ]

  srcjar_deps = [ ":infobar_android_enums" ]
}

generate_jni("jni_headers") {
  sources = [
    "java/src/org/chromium/components/infobars/ConfirmInfoBar.java",
    "java/src/org/chromium/components/infobars/InfoBar.java",
  ]
}

android_library("unit_device_javatests") {
  testonly = true
  sources = [
    "java/src/org/chromium/components/infobars/InfoBarControlLayoutTest.java",
  ]
  deps = [
    ":java",
    "//base:base_java_test_support",
    "//components/browser_ui/theme/android:java_resources",
    "//components/browser_ui/widget/android:java",
    "//third_party/androidx:androidx_appcompat_appcompat_java",
    "//third_party/androidx:androidx_test_monitor_java",
    "//third_party/androidx:androidx_test_rules_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/junit:junit",
  ]
  resources_package = "org.chromium.components.infobars.test"
}