chromium/chrome/browser/ui/blocked_content/BUILD.gn

# Copyright 2024 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/ozone.gni")

assert(is_win || is_mac || is_linux || is_chromeos || is_android)

source_set("blocked_content") {
  sources = [
    "blocked_window_params.h",
    "chrome_popup_navigation_delegate.h",
    "tab_under_navigation_throttle.h",
  ]

  public_deps = [
    "//base",
    "//chrome/browser/ui:browser_navigator_params_headers",
    "//components/blocked_content",
    "//content/public/browser",
    "//content/public/common",
    "//third_party/blink/public/common",
    "//ui/base:types",
    "//url",
  ]

  if (!is_android) {
    sources += [
      "framebust_block_tab_helper.h",
      "popunder_preventer.h",
    ]
  }
}

source_set("impl") {
  sources = [
    "blocked_window_params.cc",
    "chrome_popup_navigation_delegate.cc",
    "tab_under_navigation_throttle.cc",
  ]

  deps = [
    ":blocked_content",
    "//chrome/browser/profiles:profile",
    "//chrome/common:constants",
    "//chrome/common:mojo_bindings",
    "//components/content_settings/core/browser",
    "//extensions/buildflags",
    "//services/metrics/public/cpp:ukm_builders",
  ]

  public_deps = [ "//chrome/browser:browser_public_dependencies" ]

  if (!is_android) {
    sources += [
      "framebust_block_tab_helper.cc",
      "popunder_preventer.cc",
    ]

    deps += [
      "//components/guest_view/browser",
      "//extensions/common:common_constants",
    ]
  } else {  # !is_android
    deps += [
      "//components/messages/android",
      "//components/messages/android:feature_flags",
    ]
  }
}

if (!is_android) {
  source_set("browser_tests") {
    testonly = true
    defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
    sources = [
      "popup_opener_tab_helper_browsertest.cc",
      "popup_tracker_browsertest.cc",
      "safe_browsing_triggered_popup_blocker_browsertest.cc",
      "tab_under_blocker_browsertest.cc",
    ]
    deps = [
      ":blocked_content",
      "//chrome/test:test_support",
      "//components/back_forward_cache:back_forward_cache",
      "//components/content_settings/browser",
    ]
    if (use_ozone) {
      deps += [ "//ui/ozone" ]
    }
  }
}

if (!is_android && !is_chromeos_device) {
  source_set("interactive_ui_tests") {
    testonly = true
    defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
    sources = [ "popup_blocker_browsertest.cc" ]
    deps = [
      ":blocked_content",
      "//chrome/browser/search_engines:search_engines",
      "//chrome/browser/web_applications:web_applications_test_support",
      "//chrome/test:test_support",
      "//components/back_forward_cache:back_forward_cache",
      "//components/content_settings/browser",
      "//components/embedder_support:embedder_support",
      "//components/javascript_dialogs:javascript_dialogs",
    ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = [ "popup_opener_tab_helper_unittest.cc" ]
  deps = [
    ":blocked_content",
    "//chrome/test:test_support",
    "//components/content_settings/browser",
    "//components/ukm/content",
  ]
  if (is_android) {
    deps += [
      "//components/infobars/android",
      "//components/messages/android:test_support",
      "//components/ukm:test_support",
    ]
  }
}