chromium/chrome/browser/notifications/BUILD.gn

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

if (is_android) {
  import("//build/config/android/rules.gni")
  import("//third_party/jni_zero/jni_zero.gni")
}

source_set("notifications") {
  public_deps = [
    "//chrome/browser/notifications/proto",
    "//chrome/browser/notifications/scheduler",
  ]

  sources = []

  if (is_android) {
    deps = [
      ":jni_headers",
      "//base",
      "//chrome/common",
      "//components/content_settings/core/browser",
      "//components/content_settings/core/common",
      "//components/keyed_service/core",
      "//components/pref_registry",
      "//components/prefs",
      "//components/search_engines",
      "//content/public/browser",
      "//url",
    ]

    sources += [
      "notification_channels_provider_android.cc",
      "notification_channels_provider_android.h",
    ]
  }
}

group("unit_tests") {
  testonly = true
  deps = [ "//chrome/browser/notifications/scheduler:unit_tests" ]
}

if (is_android) {
  android_library("java") {
    sources = [
      "android/java/src/org/chromium/chrome/browser/notifications/ChromeNotificationWrapperCompatBuilder.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationConstants.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptor.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtil.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationUmaTracker.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactory.java",
      "android/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java",
      "android/java/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdater.java",
      "android/java/src/org/chromium/chrome/browser/notifications/channels/ChromeChannelDefinitions.java",
      "android/java/src/org/chromium/chrome/browser/notifications/channels/LocaleChangedBroadcastReceiver.java",
      "android/java/src/org/chromium/chrome/browser/notifications/channels/SiteChannelsManager.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/NotificationPermissionChangeReceiver.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/NotificationPermissionController.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/NotificationPermissionRationaleBottomSheet.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/NotificationPermissionRationaleDialogController.java",
    ]

    deps = [
      ":java_resources",
      "//base:base_java",
      "//build/android:build_java",
      "//chrome/android:base_module_java",
      "//chrome/browser/flags:java",
      "//chrome/browser/preferences:java",
      "//chrome/browser/profiles/android:java",
      "//components/browser_ui/bottomsheet/android:java",
      "//components/browser_ui/notifications/android:java",
      "//components/browser_ui/settings/android:java",
      "//components/browser_ui/site_settings/android:java",
      "//components/browser_ui/widget/android:java",
      "//components/content_settings/android:content_settings_enums_java",
      "//components/url_formatter/android:url_formatter_java",
      "//content/public/android:content_full_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_core_core_java",
      "//third_party/jni_zero:jni_zero_java",
      "//ui/android:ui_no_recycler_view_java",
    ]

    srcjar_deps = [
      ":jni_headers",
      ":notifications_java_enum_srcjar",
    ]
    resources_package = "org.chromium.chrome.browser.notifications"
  }

  java_cpp_enum("notifications_java_enum_srcjar") {
    sources = [ "notification_channels_provider_android.h" ]
  }

  generate_jni("jni_headers") {
    sources = [
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtil.java",
    ]
  }

  robolectric_library("junit_tests") {
    resources_package = "org.chromium.chrome.browser.notifications"
    sources = [
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBaseTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptorTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtilUnitTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationTestUtil.java",
      "android/java/src/org/chromium/chrome/browser/notifications/PendingIntentProviderTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/ThrottlingNotificationSchedulerTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializerTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/channels/ChromeChannelDefinitionsTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/NotificationPermissionChangeReceiverTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/NotificationPermissionControllerTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/NotificationPermissionRationaleBottomSheetTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/NotificationPermissionRationaleDialogControllerTest.java",
      "android/java/src/org/chromium/chrome/browser/notifications/permissions/TestRationaleDelegate.java",
    ]

    deps = [
      ":java",
      ":java_resources",
      "//base:base_java",
      "//base:base_java_test_support",
      "//base:base_java_test_support_uncommon",
      "//base:base_junit_test_support",
      "//chrome/browser/flags:java",
      "//chrome/browser/preferences:java",
      "//chrome/browser/ui/android/signin:java_resources",
      "//chrome/test/android:chrome_java_unit_test_support",
      "//components/browser_ui/bottomsheet/android:java",
      "//components/browser_ui/notifications/android:java",
      "//components/embedder_support/android:junit_test_support",
      "//components/url_formatter/android:url_formatter_java",
      "//third_party/android_deps:espresso_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_ext_junit_java",
      "//third_party/hamcrest:hamcrest_core_java",
      "//third_party/hamcrest:hamcrest_library_java",
      "//third_party/jni_zero:jni_zero_java",
      "//third_party/junit",
      "//third_party/mockito:mockito_java",
      "//ui/android:ui_java_test_support",
      "//ui/android:ui_no_recycler_view_java",
    ]
  }

  android_library("javatests") {
    testonly = true
    resources_package = "org.chromium.chrome.browser.notifications"

    sources = [
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationTestUtil.java",
      "android/java/src/org/chromium/chrome/browser/notifications/NotificationWrapperBuilderFactoryTest.java",
    ]

    deps = [
      ":java",
      ":java_resources",
      "//base:base_java",
      "//base:base_java_test_support",
      "//chrome/browser/flags:java",
      "//chrome/browser/preferences:java",
      "//chrome/test/android:chrome_java_integration_test_support",
      "//components/browser_ui/notifications/android:java",
      "//components/browser_ui/util/android:java",
      "//components/browser_ui/widget/android:java",
      "//content/public/test/android:content_java_test_support",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/androidx:androidx_test_core_java",
      "//third_party/androidx:androidx_test_monitor_java",
      "//third_party/androidx:androidx_test_runner_java",
      "//third_party/hamcrest:hamcrest_core_java",
      "//third_party/hamcrest:hamcrest_library_java",
      "//third_party/junit",
      "//third_party/mockito:mockito_java",
      "//url:gurl_java",
    ]
  }

  android_resources("java_resources") {
    sources = [
      "android/java/res/drawable-ldrtl/notification_permission_rationale_dialog_header.xml",
      "android/java/res/drawable/notification_permission_rationale_dialog_header.xml",
      "android/java/res/layout/notification_permission_rationale_bottom_sheet.xml",
      "android/java/res/layout/notification_permission_rationale_dialog.xml",
      "android/java/res/values-night/colors.xml",
      "android/java/res/values/colors.xml",
    ]

    deps = [
      "//chrome/browser/ui/android/strings:ui_strings_grd",
      "//components/browser_ui/strings/android:browser_ui_strings_grd",
      "//components/browser_ui/styles/android:java_resources",
      "//components/browser_ui/widget/android:java_resources",
      "//ui/android:ui_java_resources",
    ]
  }
}