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

# 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/features.gni")
import("//ppapi/buildflags/buildflags.gni")

static_library("browser") {
  sources = [
    "content_settings_default_provider.cc",
    "content_settings_default_provider.h",
    "content_settings_global_value_map.cc",
    "content_settings_global_value_map.h",
    "content_settings_info.cc",
    "content_settings_info.h",
    "content_settings_observable_provider.cc",
    "content_settings_observable_provider.h",
    "content_settings_observer.h",
    "content_settings_origin_value_map.cc",
    "content_settings_origin_value_map.h",
    "content_settings_partitioned_origin_value_map.cc",
    "content_settings_partitioned_origin_value_map.h",
    "content_settings_policy_provider.cc",
    "content_settings_policy_provider.h",
    "content_settings_pref.cc",
    "content_settings_pref.h",
    "content_settings_pref_provider.cc",
    "content_settings_pref_provider.h",
    "content_settings_provider.cc",
    "content_settings_provider.h",
    "content_settings_registry.cc",
    "content_settings_registry.h",
    "content_settings_rule.cc",
    "content_settings_rule.h",
    "content_settings_type_set.h",
    "content_settings_uma_util.cc",
    "content_settings_uma_util.h",
    "content_settings_utils.cc",
    "content_settings_utils.h",
    "host_content_settings_map.cc",
    "host_content_settings_map.h",
    "private_network_settings.cc",
    "private_network_settings.h",
    "user_modifiable_provider.cc",
    "user_modifiable_provider.h",
    "website_settings_info.cc",
    "website_settings_info.h",
    "website_settings_registry.cc",
    "website_settings_registry.h",
  ]

  public_deps = [ "//base" ]
  deps = [
    "//build:blink_buildflags",
    "//build:chromeos_buildflags",
    "//components/content_settings/core/common",
    "//components/keyed_service/core",
    "//components/pref_registry:pref_registry",
    "//components/prefs",
    "//components/privacy_sandbox:features",
    "//components/privacy_sandbox:tracking_protection_prefs",
    "//components/tpcd/metadata/browser",
    "//components/url_formatter",
    "//extensions/buildflags",
    "//net",
    "//services/network/public/mojom",
    "//services/preferences/public/cpp",
    "//services/tracing/public/cpp",
    "//url",
  ]

  if (!is_ios) {
    sources += [
      "insecure_private_network_policy_handler.cc",
      "insecure_private_network_policy_handler.h",
    ]
  }

  if (use_blink) {
    deps += [
      "//components/policy:generated",
      "//components/policy/core/browser",
      "//components/privacy_sandbox:privacy_sandbox_prefs",
    ]
  }

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

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

  if (!is_ios) {
    sources += [
      "cookie_settings_policy_handler.cc",
      "cookie_settings_policy_handler.h",
    ]
  }
  public_deps = [ "//base" ]

  deps = [
    ":browser",
    "//build:blink_buildflags",
    "//build:chromeos_buildflags",
    "//components/content_settings/core/common",
    "//components/keyed_service/core",
    "//components/policy/core/browser",
    "//components/pref_registry:pref_registry",
    "//components/prefs",
    "//components/privacy_sandbox:features",
    "//components/privacy_sandbox:tracking_protection_prefs",
    "//components/privacy_sandbox:tracking_protection_settings",
    "//components/tpcd/metadata/browser",
    "//extensions/buildflags",
    "//net",
    "//url",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "content_settings_partitioned_origin_value_map_unittest.cc",
    "content_settings_pref_unittest.cc",
    "content_settings_registry_unittest.cc",
    "content_settings_rule_unittest.cc",
    "content_settings_utils_unittest.cc",
    "cookie_settings_unittest.cc",
    "website_settings_registry_unittest.cc",
  ]

  if (enable_plugins) {
    sources += [ "content_settings_provider_unittest.cc" ]
  }

  deps = [
    ":browser",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//components/content_settings/core/common",
    "//components/content_settings/core/test:test_support",
    "//components/pref_registry:pref_registry",
    "//components/prefs",
    "//components/prefs:test_support",
    "//components/privacy_sandbox:features",
    "//components/privacy_sandbox:privacy_sandbox_prefs",
    "//components/privacy_sandbox:tracking_protection_prefs",
    "//components/privacy_sandbox:tracking_protection_settings",
    "//components/sync_preferences:test_support",
    "//components/tpcd/metadata/browser",
    "//extensions/buildflags",
    "//net",
    "//ppapi/buildflags:buildflags",
    "//services/preferences/public/cpp",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]

  if (use_blink) {
    # Policies haven't been updated for iOS yet since blink
    # support is only a prototype.
    if (!is_ios) {
      sources += [ "cookie_settings_policy_handler_unittest.cc" ]
    }

    deps += [
      "//components/policy:generated",
      "//components/policy/core/browser:test_support",
    ]
  }
}

source_set("test_support") {
  testonly = true
  sources = [
    "content_settings_mock_observer.cc",
    "content_settings_mock_observer.h",
  ]
  public_deps = [ ":browser" ]
  deps = [ "//testing/gmock" ]
}