# Copyright 2017 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/features.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//third_party/jni_zero/jni_zero.gni")
}
if (use_blink) {
static_library("internal") {
visibility = [
":*",
"//components/download/content/factory",
"//components/download/content/internal",
"//components/download/internal/background_service/test:test_support",
]
sources = [
"blob_task_proxy.cc",
"blob_task_proxy.h",
"controller_impl.cc",
"controller_impl.h",
"download_driver.h",
"entry_utils.cc",
"entry_utils.h",
"in_memory_download.cc",
"in_memory_download.h",
"in_memory_download_driver.cc",
"in_memory_download_driver.h",
"navigation_monitor_impl.cc",
"navigation_monitor_impl.h",
"scheduler/battery_status_listener.h",
"scheduler/battery_status_listener_impl.cc",
"scheduler/battery_status_listener_impl.h",
"scheduler/device_status.cc",
"scheduler/device_status.h",
"scheduler/device_status_listener.cc",
"scheduler/device_status_listener.h",
"scheduler/scheduler.h",
"scheduler/scheduler_impl.cc",
"scheduler/scheduler_impl.h",
]
deps = [
":common",
":storage",
"//base",
"//components/download/network",
"//components/download/public/background_service:public",
"//net",
"//services/network/public/cpp",
"//storage/browser",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
if (is_android) {
sources += [
"android/battery_status_listener_android.cc",
"android/battery_status_listener_android.h",
]
deps += [ ":jni_headers" ]
}
if (is_apple) {
sources += [
"scheduler/battery_status_listener_mac.cc",
"scheduler/battery_status_listener_mac.h",
]
}
}
}
if (is_android) {
android_library("internal_java") {
sources = [ "android/java/src/org/chromium/components/download/internal/BatteryStatusListenerAndroid.java" ]
deps = [
"//base:base_java",
"//net/android:net_java",
"//third_party/jni_zero:jni_zero_java",
]
}
generate_jni("jni_headers") {
visibility = [ ":*" ]
sources = [ "android/java/src/org/chromium/components/download/internal/BatteryStatusListenerAndroid.java" ]
}
}
source_set("common") {
sources = [
"client_set.cc",
"client_set.h",
"config.cc",
"config.h",
"constants.h",
"controller.h",
"debugging_client.cc",
"debugging_client.h",
"download_blockage_status.cc",
"download_blockage_status.h",
"driver_entry.cc",
"driver_entry.h",
"empty_file_monitor.cc",
"empty_file_monitor.h",
"file_monitor.h",
"file_monitor_impl.cc",
"file_monitor_impl.h",
"init_aware_background_download_service.cc",
"init_aware_background_download_service.h",
"initializable_background_download_service.h",
"log_sink.h",
"log_source.h",
"logger_impl.cc",
"logger_impl.h",
"service_config_impl.cc",
"service_config_impl.h",
"startup_status.cc",
"startup_status.h",
"stats.cc",
"stats.h",
]
visibility = [
":*",
"//components/download/content/factory",
"//components/download/content/internal",
"//components/download/internal/background_service/ios:background_service",
"//components/download/internal/background_service/ios:unit_tests",
"//components/download/internal/background_service/test:test_support",
"//ios/chrome/browser/download/model/background_service:background_service",
]
deps = [
":storage",
"//base",
"//build:blink_buildflags",
"//components/download/public/background_service:public",
"//services/network/public/cpp",
]
if (use_blink) {
deps += [ "//storage/browser" ]
}
configs += [ "//build/config/compiler:wexit_time_destructors" ]
}
source_set("storage") {
sources = [
"download_store.cc",
"download_store.h",
"entry.cc",
"entry.h",
"model.h",
"model_impl.cc",
"model_impl.h",
"model_stats.cc",
"model_stats.h",
"noop_store.cc",
"noop_store.h",
"proto_conversions.cc",
"proto_conversions.h",
"store.h",
]
visibility = [
":*",
"//components/download/content/factory",
"//components/download/internal/background_service/ios:background_service",
"//components/download/internal/background_service/test:test_support",
"//ios/chrome/browser/download/model/background_service",
]
deps = [
"//base",
"//components/download/internal/background_service/proto",
"//components/download/public/background_service:public",
"//components/leveldb_proto",
"//net",
"//services/network/public/mojom:url_loader_base",
"//url",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
}
source_set("unit_tests") {
testonly = true
sources = [
"file_monitor_unittest.cc",
"service_config_impl_unittest.cc",
"stats_unittest.cc",
]
if (use_blink) {
sources += [
"client_set_unittest.cc",
"controller_impl_unittest.cc",
"download_store_unittest.cc",
"entry_utils_unittest.cc",
"in_memory_download_driver_unittest.cc",
"in_memory_download_unittest.cc",
"init_aware_background_download_service_unittest.cc",
"model_impl_unittest.cc",
"navigation_monitor_impl_unittests.cc",
"proto_conversions_unittest.cc",
"scheduler/device_status_listener_unittest.cc",
"scheduler/scheduler_impl_unittest.cc",
]
}
deps = [
":common",
":storage",
"//base/test:test_support",
"//components/download/internal/background_service/test:test_support",
"//testing/gmock",
"//testing/gtest",
]
if (use_blink) {
deps += [
":internal",
"//components/download/internal/background_service/proto",
"//components/download/network",
"//components/download/public/background_service/test:test_support",
"//components/leveldb_proto:test_support",
"//services/network:test_support",
"//storage/browser",
]
}
}