chromium/components/content_settings/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")

generate_jni("content_settings_jni_headers") {
  sources = [
    "java/src/org/chromium/components/content_settings/ContentSettingsObserver.java",
    "java/src/org/chromium/components/content_settings/CookieControlsBridge.java",
  ]
}

android_library("java") {
  srcjar_deps = [ ":content_settings_jni_headers" ]
  sources = [
    "java/src/org/chromium/components/content_settings/ContentSettingsObserver.java",
    "java/src/org/chromium/components/content_settings/CookieControlsBridge.java",
    "java/src/org/chromium/components/content_settings/CookieControlsObserver.java",
  ]
  deps = [
    ":content_settings_enums_java",
    "//build/android:build_java",
    "//components/content_settings/core/common:content_settings_types_java",
    "//content/public/android:content_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
  ]
}

generate_jni("native_j_unittests_jni_headers") {
  testonly = true
  sources = [ "native_java_unittests/src/org/chromium/components/content_settings/CookieControlsBridgeUnitTest.java" ]
}

android_library("native_java_unittests_java") {
  testonly = true
  deps = [
    ":content_settings_enums_java",
    ":java",
    "//third_party/jni_zero:jni_zero_java",
    "//third_party/junit",
  ]
  srcjar_deps = [ ":native_j_unittests_jni_headers" ]
  sources = [ "native_java_unittests/src/org/chromium/components/content_settings/CookieControlsBridgeUnitTest.java" ]
}

source_set("android") {
  sources = [
    "content_settings_observer_android.cc",
    "content_settings_observer_android.h",
    "cookie_controls_bridge.cc",
    "cookie_controls_bridge.h",
  ]
  deps = [
    ":content_settings_jni_headers",
    "//components/content_settings/browser/ui",
    "//components/content_settings/core/browser",
    "//components/content_settings/core/browser:cookie_settings",
    "//components/content_settings/core/common",
    "//components/permissions",
    "//content/public/browser",
  ]
  public_deps = [ "//base" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "cookie_controls_bridge_unittest.cc" ]
  deps = [
    ":android",
    ":native_j_unittests_jni_headers",
    ":native_java_unittests_java",
    "//base/test:test_support",
  ]
}

android_library("content_settings_enums_java") {
  sources = [ "java/src/org/chromium/components/content_settings/ContentSettingsTypeSet.java" ]
  srcjar_deps = [ ":content_settings_enums_javagen" ]
  deps = [ "//third_party/androidx:androidx_annotation_annotation_java" ]
  public_deps = [
    "//components/content_settings/core/common:content_settings_enums_java",
    "//components/content_settings/core/common:content_settings_types_java",
  ]
}

java_cpp_enum("content_settings_enums_javagen") {
  sources = [
    "../core/browser/cookie_settings.h",
    "../core/common/content_settings.h",
    "../core/common/cookie_blocking_3pcd_status.h",
    "../core/common/cookie_controls_enforcement.h",
    "../core/common/tracking_protection_feature.h",
  ]
  visibility = [ ":*" ]  # Depend on through :content_settings_enums_java
}

java_cpp_strings("java_pref_names_srcjar") {
  sources = [ "//components/content_settings/core/common/pref_names.h" ]

  template = "java_templates/PrefNames.java.tmpl"
}