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

import("//chrome/common/features.gni")
import("//mojo/public/tools/bindings/mojom.gni")

source_set("common") {
  sources = [
    "safebrowsing_constants.cc",
    "safebrowsing_constants.h",
    "safebrowsing_switches.cc",
    "safebrowsing_switches.h",
    "utils.cc",
    "utils.h",
  ]

  deps = [
    "//base",
    "//components/policy/core/browser:browser",
    "//components/safe_browsing:csd_proto",
    "//crypto:crypto",
    "//ipc",
    "//url/ipc:url_ipc",
  ]

  public_deps = [
    ":interfaces",
  ]
}

static_library("safe_browsing_prefs") {
  sources = [
    "safe_browsing_prefs.cc",
    "safe_browsing_prefs.h",
  ]

  deps = [
    "//base:base",
    "//components/pref_registry:pref_registry",
    "//components/prefs",
    "//components/safe_browsing:features",
    "//content/public/browser:browser",
    "//net:net",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "safe_browsing_prefs_unittest.cc",
  ]
  deps = [
    ":safe_browsing_prefs",
    "//base:base",
    "//base/test:test_support",
    "//components/prefs:test_support",
    "//components/safe_browsing:features",
    "//content/test:test_support",
    "//testing/gtest",
    "//url:url",
  ]
}

mojom("interfaces") {
  sources = [
    "safe_browsing.mojom",
  ]

  public_deps = [
    "//content/public/common:resource_type_bindings",
    "//services/network/public/mojom",
    "//url/mojom:url_mojom_gurl",
  ]

  enabled_features = []
  if (safe_browsing_mode == 1) {
    enabled_features += [ "full_safe_browsing" ]
  }
}
