chromium/components/safe_browsing/core/browser/BUILD.gn

# 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")

source_set("browser") {
  sources = [
    "database_manager_mechanism.cc",
    "database_manager_mechanism.h",
    "hash_realtime_mechanism.cc",
    "hash_realtime_mechanism.h",
    "ping_manager.cc",
    "ping_manager.h",
    "safe_browsing_hats_delegate.cc",
    "safe_browsing_hats_delegate.h",
    "safe_browsing_lookup_mechanism.cc",
    "safe_browsing_lookup_mechanism.h",
    "safe_browsing_lookup_mechanism_runner.cc",
    "safe_browsing_lookup_mechanism_runner.h",
    "safe_browsing_url_checker_impl.cc",
    "safe_browsing_url_checker_impl.h",
    "url_checker_delegate.h",
    "url_realtime_mechanism.cc",
    "url_realtime_mechanism.h",
    "user_population.cc",
    "user_population.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  public_deps = [ "//google_apis:google_apis" ]

  deps = [
    "//base",
    "//components/keyed_service/core",
    "//components/prefs",
    "//components/safe_browsing/core/browser:sync_observer",
    "//components/safe_browsing/core/browser:token_fetcher",
    "//components/safe_browsing/core/browser/db:database_manager",
    "//components/safe_browsing/core/browser/db:hit_report",
    "//components/safe_browsing/core/browser/db:util",
    "//components/safe_browsing/core/browser/db:v4_protocol_manager_util",
    "//components/safe_browsing/core/browser/hashprefix_realtime:hash_realtime_service",
    "//components/safe_browsing/core/browser/realtime:policy_engine",
    "//components/safe_browsing/core/browser/realtime:url_lookup_service_base",
    "//components/safe_browsing/core/browser/utils",
    "//components/safe_browsing/core/common:common",
    "//components/safe_browsing/core/common/hashprefix_realtime:hash_realtime_utils",
    "//components/safe_browsing/core/common/proto:csd_proto",
    "//components/safe_browsing/core/common/proto:realtimeapi_proto",
    "//components/security_interstitials/core:unsafe_resource",
    "//components/sessions:session_id",
    "//components/unified_consent",
    "//components/version_info",
    "//net",
    "//net:extras",
    "//services/network/public/cpp",
    "//services/network/public/mojom",
  ]
}

source_set("ping_manager_unittest") {
  testonly = true
  sources = [ "ping_manager_unittest.cc" ]

  deps = [
    ":browser",
    "//base:base",
    "//components/safe_browsing/core/browser:token_fetcher_testing_helper",
    "//components/safe_browsing/core/browser/db:v4_test_util",
    "//components/safe_browsing/core/common",
    "//net:net",
    "//net:test_support",
    "//services/network:test_support",
    "//testing/gtest",
  ]
}

source_set("safe_browsing_url_checker_unittest") {
  testonly = true
  sources = [ "safe_browsing_url_checker_impl_unittest.cc" ]
  deps = [
    ":browser",
    "//base/test:test_support",
    "//components/safe_browsing/core/browser:token_fetcher",
    "//components/safe_browsing/core/browser/db:test_database_manager",
    "//components/safe_browsing/core/browser/db:util",
    "//components/safe_browsing/core/browser/hashprefix_realtime:hash_realtime_service",
    "//components/safe_browsing/core/browser/realtime:test_support",
    "//components/safe_browsing/core/browser/realtime:url_lookup_service",
    "//components/safe_browsing/core/common",
    "//components/safe_browsing/core/common/hashprefix_realtime:hash_realtime_utils",
    "//components/safe_browsing/core/common/proto:csd_proto",
    "//components/security_interstitials/core:unsafe_resource",
    "//components/sessions:session_id",
    "//net/traffic_annotation:test_support",
    "//services/network/public/cpp",
    "//services/network/public/mojom",
    "//testing/gtest",
  ]
}

# NOTE: This target is separated from :browser as
# //components/safe_browsing/core/browser/realtime:url_lookup_service_base,
# which :browser depends on, depends on this.
# TODO(crbug.com/40770425): Consider folding all of three these together into
# :browser, along with the rest of //components/safe_browsing/core/browser.
source_set("verdict_cache_manager") {
  sources = [
    "verdict_cache_manager.cc",
    "verdict_cache_manager.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  deps = [
    "//base",
    "//components/content_settings/core/browser",
    "//components/history/core/browser",
    "//components/keyed_service/core:core",
    "//components/password_manager/core/browser:browser",
    "//components/prefs",
    "//components/safe_browsing/core/browser:sync_observer",
    "//components/safe_browsing/core/browser/db:v4_protocol_manager_util",
    "//components/safe_browsing/core/browser/hashprefix_realtime:hash_realtime_cache",
    "//components/safe_browsing/core/common",
    "//components/safe_browsing/core/common/hashprefix_realtime:hash_realtime_utils",
    "//components/safe_browsing/core/common/proto:csd_proto",
    "//components/safe_browsing/core/common/proto:realtimeapi_proto",
    "//components/safe_browsing/core/common/proto:safebrowsingv5_proto",
    "//url",
  ]
}

source_set("verdict_cache_manager_unittest") {
  testonly = true
  sources = [ "verdict_cache_manager_unittest.cc" ]

  deps = [
    ":verdict_cache_manager",
    "//base",
    "//base/test:test_support",
    "//components/content_settings/core/browser",
    "//components/safe_browsing/core/browser:sync_observer",
    "//components/safe_browsing/core/browser/db:v4_protocol_manager_util",
    "//components/safe_browsing/core/common",
    "//components/safe_browsing/core/common:safe_browsing_prefs",
    "//components/safe_browsing/core/common/hashprefix_realtime:hash_realtime_utils",
    "//components/safe_browsing/core/common/proto:csd_proto",
    "//components/safe_browsing/core/common/proto:realtimeapi_proto",
    "//components/safe_browsing/core/common/proto:safebrowsingv5_proto",
    "//components/sync_preferences:test_support",
    "//testing/gtest",
  ]
}
source_set("referrer_chain_provider") {
  sources = [ "referrer_chain_provider.h" ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  deps = [
    "//components/safe_browsing/core/common/proto:csd_proto",
    "//components/sessions",
  ]
}

source_set("sync_observer") {
  sources = [ "safe_browsing_sync_observer.h" ]

  deps = [ "//base" ]
}

source_set("token_fetcher") {
  sources = [
    "safe_browsing_token_fetch_tracker.cc",
    "safe_browsing_token_fetch_tracker.h",
    "safe_browsing_token_fetcher.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  deps = [ "//base" ]
}

source_set("token_fetcher_unit_tests") {
  testonly = true
  sources = [ "safe_browsing_token_fetch_tracker_unittest.cc" ]

  deps = [
    ":token_fetcher",
    "//base/test:test_support",
    "//testing/gtest",
  ]
  if (is_ios) {
    deps += [ "//components/test:safe_browsing_test_bundle_data" ]
  }
}

source_set("token_fetcher_testing_helper") {
  testonly = true
  sources = [
    "test_safe_browsing_token_fetcher.cc",
    "test_safe_browsing_token_fetcher.h",
  ]

  deps = [
    ":token_fetcher",
    "//base",
    "//testing/gmock",
  ]
}

source_set("safe_browsing_hats_delegate_unittest") {
  testonly = true
  sources = [ "safe_browsing_hats_delegate_unittest.cc" ]
  deps = [
    ":browser",
    "//base/test:test_support",
    "//testing/gtest",
  ]
}

source_set("download_check_result") {
  sources = [ "download_check_result.h" ]
}

source_set("safe_browsing_metrics_collector") {
  sources = [
    "safe_browsing_metrics_collector.cc",
    "safe_browsing_metrics_collector.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  deps = [
    "//base",
    "//components/keyed_service/core",
    "//components/password_manager/core/common",
    "//components/prefs",
    "//components/safe_browsing/core/browser/db:hit_report",
    "//components/safe_browsing/core/common:safe_browsing_prefs",
  ]
}

source_set("safe_browsing_metrics_collector_unittest") {
  testonly = true
  sources = [ "safe_browsing_metrics_collector_unittest.cc" ]
  deps = [
    ":safe_browsing_metrics_collector",
    "//base",
    "//base/test:test_support",
    "//components/password_manager/core/common",
    "//components/prefs",
    "//components/prefs:test_support",
    "//components/safe_browsing/core/common",
    "//components/safe_browsing/core/common:safe_browsing_prefs",
    "//testing/gtest",
  ]
}

source_set("user_population_unittest") {
  testonly = true
  sources = [ "user_population_unittest.cc" ]
  deps = [
    ":browser",
    "////components/safe_browsing/core/common",
    "//base",
    "//base/test:test_support",
    "//components/prefs",
    "//components/safe_browsing:buildflags",
    "//components/safe_browsing/core/common:safe_browsing_prefs",
    "//components/sync_preferences:test_support",
    "//components/unified_consent:unified_consent",
    "//components/version_info",
    "//testing/gtest",
  ]
}