# Copyright 2014 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/chromeos/ui_mode.gni")
import("//components/safe_browsing/buildflags.gni")
import("//extensions/buildflags/buildflags.gni")
static_library("safe_browsing") {
sources = [
"chrome_controller_client.cc",
"chrome_controller_client.h",
"chrome_safe_browsing_tab_observer_delegate.cc",
"chrome_safe_browsing_tab_observer_delegate.h",
"url_checker_delegate_impl.cc",
"url_checker_delegate_impl.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
public_deps = [ "//chrome/browser:browser_public_dependencies" ]
allow_circular_includes_from = []
deps = [
"//build:branding_buildflags",
"//chrome/app:generated_resources",
"//chrome/browser:browser_process",
"//chrome/browser/google",
"//chrome/browser/profiles",
"//chrome/browser/profiles:profile",
"//chrome/browser/sync",
"//chrome/common",
"//chrome/common:constants",
"//components/browser_sync",
"//components/enterprise:enterprise",
"//components/enterprise/buildflags",
"//components/enterprise/common:strings",
"//components/keyed_service/content",
"//components/language/core/browser",
"//components/no_state_prefetch/browser",
"//components/no_state_prefetch/common",
"//components/page_info",
"//components/password_manager/core/browser",
"//components/password_manager/core/browser:hash_password_manager",
"//components/pref_registry",
"//components/resources:components_resources_grit",
"//components/safe_browsing:buildflags",
"//components/safe_browsing/content/browser",
"//components/safe_browsing/content/browser:client_side_detection",
"//components/safe_browsing/content/browser:client_side_detection_service",
"//components/safe_browsing/content/browser/triggers:suspicious_site_trigger",
"//components/safe_browsing/content/browser/web_ui",
"//components/safe_browsing/core/browser",
"//components/safe_browsing/core/browser:download_check_result",
"//components/safe_browsing/core/browser:referrer_chain_provider",
"//components/safe_browsing/core/browser:safe_browsing_metrics_collector",
"//components/safe_browsing/core/browser/db:database_manager",
"//components/safe_browsing/core/browser/db:v4_local_database_manager",
"//components/safe_browsing/core/browser/password_protection:password_protection_metrics_util",
"//components/safe_browsing/core/browser/sync",
"//components/safe_browsing/core/common",
"//components/safe_browsing/core/common:interfaces",
"//components/safe_browsing/core/common:safe_browsing_policy_handler",
"//components/search_engines",
"//components/security_interstitials/content:security_interstitial_page",
"//components/security_interstitials/core",
"//components/sessions",
"//components/signin/public/identity_manager",
"//components/url_formatter",
"//components/vector_icons:vector_icons",
"//mojo/public/cpp/platform",
"//mojo/public/cpp/system",
"//services/preferences/public/cpp",
]
if (is_android) {
deps += [
"//chrome/browser/password_manager/android:utils",
"//components/safe_browsing/android:safe_browsing_api_handler",
"//components/safe_browsing/android:safe_browsing_api_handler_util",
]
}
if (is_chromeos_ash) {
deps += [ "//chrome/browser/ash/file_manager" ]
allow_circular_includes_from += [ "//chrome/browser/ash/file_manager" ]
}
if (safe_browsing_mode != 0) {
# "Safe Browsing Basic" files used for safe browsing in full mode
# (safe_browsing=1) and mobile (=2)
sources += [
"chrome_client_side_detection_host_delegate.cc",
"chrome_client_side_detection_host_delegate.h",
"chrome_client_side_detection_service_delegate.cc",
"chrome_client_side_detection_service_delegate.h",
"chrome_password_protection_service.cc",
"chrome_password_protection_service.h",
"chrome_password_protection_service_factory.cc",
"chrome_password_protection_service_factory.h",
"chrome_password_reuse_detection_manager_client.cc",
"chrome_password_reuse_detection_manager_client.h",
"chrome_ping_manager_factory.cc",
"chrome_ping_manager_factory.h",
"chrome_safe_browsing_blocking_page_factory.cc",
"chrome_safe_browsing_blocking_page_factory.h",
"chrome_safe_browsing_local_state_delegate.cc",
"chrome_safe_browsing_local_state_delegate.h",
"chrome_ui_manager_delegate.cc",
"chrome_ui_manager_delegate.h",
"chrome_user_population_helper.cc",
"chrome_user_population_helper.h",
"chrome_v4_protocol_config_provider.cc",
"chrome_v4_protocol_config_provider.h",
"client_side_detection_service_factory.cc",
"client_side_detection_service_factory.h",
"delayed_warning_navigation_throttle.cc",
"delayed_warning_navigation_throttle.h",
"download_protection/download_protection_util.cc",
"download_protection/download_protection_util.h",
"network_context_service.cc",
"network_context_service.h",
"network_context_service_factory.cc",
"network_context_service_factory.h",
"phishy_interaction_tracker.cc",
"phishy_interaction_tracker.h",
"safe_browsing_navigation_observer_manager_factory.cc",
"safe_browsing_navigation_observer_manager_factory.h",
"safe_browsing_service.cc",
"safe_browsing_service.h",
"services_delegate.cc",
"services_delegate.h",
"tailored_security/chrome_tailored_security_service.cc",
"tailored_security/chrome_tailored_security_service.h",
"tailored_security/tailored_security_service_factory.cc",
"tailored_security/tailored_security_service_factory.h",
"tailored_security/tailored_security_url_observer.cc",
"tailored_security/tailored_security_url_observer.h",
"telemetry/telemetry_service.cc",
"telemetry/telemetry_service.h",
"test_safe_browsing_blocking_page_quiet.cc",
"test_safe_browsing_blocking_page_quiet.h",
"trigger_creator.cc",
"trigger_creator.h",
"url_lookup_service_factory.cc",
"url_lookup_service_factory.h",
"user_interaction_observer.cc",
"user_interaction_observer.h",
]
deps += [
":advanced_protection",
":metrics_collector",
":verdict_cache_manager_factory",
"//build:branding_buildflags",
"//build:chromeos_buildflags",
"//chrome/browser:browser_process",
"//chrome/browser/profiles:profile",
"//chrome/common/safe_browsing:proto",
"//components/autofill/core/browser",
"//components/content_settings/core/browser",
"//components/enterprise/common/proto:connectors_proto",
"//components/no_state_prefetch/browser",
"//components/omnibox/browser",
"//components/password_manager/content/browser",
"//components/password_manager/core/browser/form_parsing",
"//components/permissions",
"//components/safe_browsing/content/browser",
"//components/safe_browsing/content/browser:client_side_detection",
"//components/safe_browsing/content/browser:client_side_detection_service",
"//components/safe_browsing/content/browser:safe_browsing_blocking_page",
"//components/safe_browsing/content/browser:safe_browsing_service",
"//components/safe_browsing/content/browser/download:download_stats",
"//components/safe_browsing/content/browser/password_protection",
"//components/safe_browsing/content/browser/triggers",
"//components/safe_browsing/content/browser/triggers:ad_sampler_trigger",
"//components/safe_browsing/content/browser/triggers:suspicious_site_trigger",
"//components/safe_browsing/content/browser/triggers:trigger_throttler",
"//components/safe_browsing/content/common:file_type_policies",
"//components/safe_browsing/core/browser",
"//components/safe_browsing/core/browser:token_fetcher",
"//components/safe_browsing/core/browser:verdict_cache_manager",
"//components/safe_browsing/core/browser/db:allowlist_checker_client",
"//components/safe_browsing/core/browser/password_protection",
"//components/safe_browsing/core/browser/password_protection:password_reuse_detection_manager_client",
"//components/safe_browsing/core/browser/realtime:policy_engine",
"//components/safe_browsing/core/browser/realtime:url_lookup_service",
"//components/safe_browsing/core/browser/sync",
"//components/safe_browsing/core/browser/tailored_security_service",
"//components/safe_browsing/core/common",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/safe_browsing/core/common/proto:csd_proto",
"//components/signin/public/identity_manager",
"//components/site_engagement/core/mojom:mojo_bindings",
"//components/sync_user_events",
"//components/unified_consent",
"//components/variations/service",
"//components/version_info",
"//content/public/browser",
"//services/preferences/public/mojom:mojom",
]
if (safe_browsing_mode == 1) {
# "Safe Browsing Full" files in addition to the "basic" ones to use for
# full safe browsing. This has some in common with "mobile."
sources += [
"../download/download_completion_blocker.cc",
"../download/download_completion_blocker.h",
"chrome_enterprise_url_lookup_service.cc",
"chrome_enterprise_url_lookup_service.h",
"chrome_enterprise_url_lookup_service_factory.cc",
"chrome_enterprise_url_lookup_service_factory.h",
"chrome_safe_browsing_hats_delegate.cc",
"chrome_safe_browsing_hats_delegate.h",
"cloud_content_scanning/binary_fcm_service.cc",
"cloud_content_scanning/binary_fcm_service.h",
"cloud_content_scanning/binary_upload_service.cc",
"cloud_content_scanning/binary_upload_service.h",
"cloud_content_scanning/cloud_binary_upload_service.cc",
"cloud_content_scanning/cloud_binary_upload_service.h",
"cloud_content_scanning/cloud_binary_upload_service_factory.cc",
"cloud_content_scanning/cloud_binary_upload_service_factory.h",
"cloud_content_scanning/connector_data_pipe_getter.cc",
"cloud_content_scanning/connector_data_pipe_getter.h",
"cloud_content_scanning/connector_upload_request.cc",
"cloud_content_scanning/connector_upload_request.h",
"cloud_content_scanning/deep_scanning_utils.cc",
"cloud_content_scanning/deep_scanning_utils.h",
"cloud_content_scanning/file_analysis_request.cc",
"cloud_content_scanning/file_analysis_request.h",
"cloud_content_scanning/file_opening_job.cc",
"cloud_content_scanning/file_opening_job.h",
"cloud_content_scanning/multipart_uploader.cc",
"cloud_content_scanning/multipart_uploader.h",
"cloud_content_scanning/resumable_uploader.cc",
"cloud_content_scanning/resumable_uploader.h",
"download_protection/check_client_download_request.cc",
"download_protection/check_client_download_request.h",
"download_protection/check_client_download_request_base.cc",
"download_protection/check_client_download_request_base.h",
"download_protection/check_file_system_access_write_request.cc",
"download_protection/check_file_system_access_write_request.h",
"download_protection/deep_scanning_request.cc",
"download_protection/deep_scanning_request.h",
"download_protection/download_feedback.cc",
"download_protection/download_feedback.h",
"download_protection/download_feedback_service.cc",
"download_protection/download_feedback_service.h",
"download_protection/download_protection_observer.cc",
"download_protection/download_protection_observer.h",
"download_protection/download_protection_service.cc",
"download_protection/download_protection_service.h",
"download_protection/download_request_maker.cc",
"download_protection/download_request_maker.h",
"download_protection/download_url_sb_client.cc",
"download_protection/download_url_sb_client.h",
"download_protection/file_analyzer.cc",
"download_protection/file_analyzer.h",
"download_protection/path_sanitizer.cc",
"download_protection/path_sanitizer.h",
"download_protection/ppapi_download_request.cc",
"download_protection/ppapi_download_request.h",
"extension_telemetry/cookies_get_all_signal.cc",
"extension_telemetry/cookies_get_all_signal.h",
"extension_telemetry/cookies_get_all_signal_processor.cc",
"extension_telemetry/cookies_get_all_signal_processor.h",
"extension_telemetry/cookies_get_signal.cc",
"extension_telemetry/cookies_get_signal.h",
"extension_telemetry/cookies_get_signal_processor.cc",
"extension_telemetry/cookies_get_signal_processor.h",
"extension_telemetry/declarative_net_request_action_signal.cc",
"extension_telemetry/declarative_net_request_action_signal.h",
"extension_telemetry/declarative_net_request_action_signal_processor.cc",
"extension_telemetry/declarative_net_request_action_signal_processor.h",
"extension_telemetry/declarative_net_request_signal.cc",
"extension_telemetry/declarative_net_request_signal.h",
"extension_telemetry/declarative_net_request_signal_processor.cc",
"extension_telemetry/declarative_net_request_signal_processor.h",
"extension_telemetry/extension_js_callstacks.cc",
"extension_telemetry/extension_js_callstacks.h",
"extension_telemetry/extension_signal.h",
"extension_telemetry/extension_signal_processor.h",
"extension_telemetry/extension_signal_util.cc",
"extension_telemetry/extension_signal_util.h",
"extension_telemetry/extension_telemetry_config_manager.cc",
"extension_telemetry/extension_telemetry_config_manager.h",
"extension_telemetry/extension_telemetry_file_processor.cc",
"extension_telemetry/extension_telemetry_file_processor.h",
"extension_telemetry/extension_telemetry_persister.cc",
"extension_telemetry/extension_telemetry_persister.h",
"extension_telemetry/extension_telemetry_service.cc",
"extension_telemetry/extension_telemetry_service.h",
"extension_telemetry/extension_telemetry_service_factory.cc",
"extension_telemetry/extension_telemetry_service_factory.h",
"extension_telemetry/extension_telemetry_uploader.cc",
"extension_telemetry/extension_telemetry_uploader.h",
"extension_telemetry/extension_web_request_reporter_impl.cc",
"extension_telemetry/extension_web_request_reporter_impl.h",
"extension_telemetry/password_reuse_signal.cc",
"extension_telemetry/password_reuse_signal.h",
"extension_telemetry/potential_password_theft_signal_processor.cc",
"extension_telemetry/potential_password_theft_signal_processor.h",
"extension_telemetry/remote_host_contacted_signal.cc",
"extension_telemetry/remote_host_contacted_signal.h",
"extension_telemetry/remote_host_contacted_signal_processor.cc",
"extension_telemetry/remote_host_contacted_signal_processor.h",
"extension_telemetry/tabs_api_signal.cc",
"extension_telemetry/tabs_api_signal.h",
"extension_telemetry/tabs_api_signal_processor.cc",
"extension_telemetry/tabs_api_signal_processor.h",
"extension_telemetry/tabs_execute_script_signal.cc",
"extension_telemetry/tabs_execute_script_signal.h",
"extension_telemetry/tabs_execute_script_signal_processor.cc",
"extension_telemetry/tabs_execute_script_signal_processor.h",
"hash_realtime_service_factory.cc",
"hash_realtime_service_factory.h",
"incident_reporting/binary_integrity_analyzer.cc",
"incident_reporting/binary_integrity_analyzer.h",
"incident_reporting/binary_integrity_incident.cc",
"incident_reporting/binary_integrity_incident.h",
"incident_reporting/delayed_analysis_callback.h",
"incident_reporting/delayed_callback_runner.cc",
"incident_reporting/delayed_callback_runner.h",
"incident_reporting/download_metadata_manager.cc",
"incident_reporting/download_metadata_manager.h",
"incident_reporting/environment_data_collection.cc",
"incident_reporting/environment_data_collection.h",
"incident_reporting/extension_data_collection.cc",
"incident_reporting/extension_data_collection.h",
"incident_reporting/incident.cc",
"incident_reporting/incident.h",
"incident_reporting/incident_handler_util.cc",
"incident_reporting/incident_handler_util.h",
"incident_reporting/incident_receiver.h",
"incident_reporting/incident_report_uploader.cc",
"incident_reporting/incident_report_uploader.h",
"incident_reporting/incident_report_uploader_impl.cc",
"incident_reporting/incident_report_uploader_impl.h",
"incident_reporting/incident_reporting_service.cc",
"incident_reporting/incident_reporting_service.h",
"incident_reporting/last_download_finder.cc",
"incident_reporting/last_download_finder.h",
"incident_reporting/platform_state_store.cc",
"incident_reporting/platform_state_store.h",
"incident_reporting/preference_validation_delegate.cc",
"incident_reporting/preference_validation_delegate.h",
"incident_reporting/resource_request_incident.cc",
"incident_reporting/resource_request_incident.h",
"incident_reporting/state_store.cc",
"incident_reporting/state_store.h",
"incident_reporting/tracked_preference_incident.cc",
"incident_reporting/tracked_preference_incident.h",
"ohttp_key_service_factory.cc",
"ohttp_key_service_factory.h",
"services_delegate_desktop.cc",
"services_delegate_desktop.h",
"tailored_security/notification_handler_desktop.cc",
"tailored_security/notification_handler_desktop.h",
]
if (is_mac) {
sources += [
"incident_reporting/binary_integrity_analyzer_mac.cc",
"incident_reporting/binary_integrity_analyzer_mac.h",
"signature_evaluator_mac.h",
"signature_evaluator_mac.mm",
]
} else if (is_win) {
sources += [
"incident_reporting/binary_integrity_analyzer_win.cc",
"incident_reporting/binary_integrity_analyzer_win.h",
"incident_reporting/environment_data_collection_win.cc",
"incident_reporting/environment_data_collection_win.h",
"incident_reporting/module_integrity_verifier_win.cc",
"incident_reporting/module_integrity_verifier_win.h",
"incident_reporting/platform_state_store_win.cc",
]
}
deps += [
":advanced_protection",
":verdict_cache_manager_factory",
"//build:branding_buildflags",
"//build:chromeos_buildflags",
"//chrome/app/vector_icons:vector_icons",
"//chrome/browser/enterprise/connectors/analysis:features",
"//chrome/common",
"//chrome/common/safe_browsing:archive_analyzer_results",
"//chrome/common/safe_browsing:binary_feature_extractor",
"//chrome/common/safe_browsing:download_type_util",
"//chrome/services/file_util/public/cpp",
"//components/content_settings/core/browser",
"//components/enterprise/common/proto:connectors_proto",
"//components/enterprise/connectors/core",
"//components/file_access",
"//components/gcm_driver",
"//components/gcm_driver/instance_id",
"//components/keyed_service/content",
"//components/language/core/common",
"//components/policy/core/browser",
"//components/prefs",
"//components/safe_browsing/content/common:interfaces",
"//components/safe_browsing/core/browser:verdict_cache_manager",
"//components/safe_browsing/core/browser/db",
"//components/safe_browsing/core/browser/db:v4_store",
"//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/common/hashprefix_realtime:hash_realtime_utils",
"//components/safe_browsing/core/common/proto:client_model_proto",
"//components/safe_browsing/core/common/proto:csd_proto",
"//components/safe_browsing/core/common/proto:realtimeapi_proto",
"//components/security_interstitials/content:security_interstitial_page",
"//components/security_interstitials/core:unsafe_resource",
"//components/sync",
"//content/public/browser",
"//extensions/browser",
"//net",
"//services/network/public/cpp:cpp",
"//third_party/abseil-cpp:absl",
]
if (is_mac) {
deps += [ "//chrome/common/safe_browsing:disk_image_type_sniffer_mac" ]
} else if (is_win) {
deps += [
"//chrome/browser/safe_browsing/incident_reporting:state_store_data_proto",
"//chrome/common:version_header",
]
}
if (is_chromeos_ash) {
deps += [
"//ash/constants:constants",
"//chromeos/ash/components/browser_context_helper:browser_context_helper",
]
}
if (is_chromeos_lacros) {
deps += [ "//chromeos/lacros:lacros" ]
}
if (is_chromeos) {
deps += [
"//chromeos/components/mgs:mgs",
"//chromeos/crosapi/cpp:cpp",
]
}
} else if (safe_browsing_mode == 2) {
if (is_android) {
sources += [
"android/services_delegate_android.cc",
"android/services_delegate_android.h",
"tailored_security/consented_message_android.cc",
"tailored_security/consented_message_android.h",
"tailored_security/unconsented_message_android.cc",
"tailored_security/unconsented_message_android.h",
"telemetry/android/android_telemetry_service.cc",
"telemetry/android/android_telemetry_service.h",
]
deps += [
"//chrome/app/vector_icons:vector_icons",
"//components/messages/android:android",
"//components/safe_browsing/android:remote_database_manager",
"//ui/android:android",
# TODO(crbug.com/41437292): Use //chrome/browser after fixing cyclic
# dependency.
"//chrome/browser/page_info:page_info_buildflags",
]
}
deps += [
"//chrome/browser/safe_browsing/android",
"//components/safe_browsing:buildflags",
"//components/safe_browsing/android:safe_browsing_mobile",
]
}
}
}
source_set("verdict_cache_manager_factory") {
sources = [
"verdict_cache_manager_factory.cc",
"verdict_cache_manager_factory.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
"//chrome/browser:browser_process",
"//chrome/browser/profiles",
"//chrome/browser/profiles:profile",
"//chrome/browser/sync",
"//chrome/common",
"//components/content_settings/core/browser",
"//components/history/core/browser",
"//components/keyed_service/content",
"//components/prefs",
"//components/safe_browsing/core/browser:verdict_cache_manager",
"//components/safe_browsing/core/browser/sync",
"//content/public/browser",
]
}
static_library("advanced_protection") {
sources = [
"advanced_protection_status_manager.cc",
"advanced_protection_status_manager.h",
"advanced_protection_status_manager_factory.cc",
"advanced_protection_status_manager_factory.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
"//chrome/browser/profiles",
"//chrome/browser/profiles:profile",
"//components/keyed_service/content",
"//components/prefs",
"//components/safe_browsing/core/common",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//components/signin/public/identity_manager",
"//content/public/browser",
]
}
source_set("metrics_collector") {
sources = [
"safe_browsing_metrics_collector_factory.cc",
"safe_browsing_metrics_collector_factory.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
"//chrome/browser:browser_process",
"//chrome/browser/profiles:profile",
"//chrome/common",
"//components/keyed_service/content",
"//components/prefs",
"//components/safe_browsing/content/browser",
"//components/safe_browsing/core/browser:safe_browsing_metrics_collector",
"//components/safe_browsing/core/common",
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//content/public/browser",
]
}
source_set("test_support") {
testonly = true
if (safe_browsing_mode != 0) {
sources = [
"test_safe_browsing_service.cc",
"test_safe_browsing_service.h",
]
if (!is_android) {
sources += [
"test_safe_browsing_navigation_observer_manager.cc",
"test_safe_browsing_navigation_observer_manager.h",
]
}
deps = [
":safe_browsing",
"//chrome/browser:browser",
"//chrome/browser/profiles:profile",
"//chrome/browser/ui:ui",
"//chrome/common",
"//chrome/common/safe_browsing:proto",
"//components/enterprise/common/proto:connectors_proto",
"//components/safe_browsing:buildflags",
"//components/safe_browsing/content/browser:browser",
"//components/safe_browsing/content/browser:safe_browsing_blocking_page",
"//components/safe_browsing/content/browser:safe_browsing_service",
"//components/safe_browsing/core/browser/db:database_manager",
"//components/safe_browsing/core/browser/db:test_database_manager",
"//components/safe_browsing/core/browser/db:v4_protocol_manager_util",
"//content/public/browser",
"//services/network:test_support",
"//testing/gtest",
]
}
if (safe_browsing_mode == 1) {
sources += [
"cloud_content_scanning/test_binary_upload_service.cc",
"cloud_content_scanning/test_binary_upload_service.h",
]
}
}