chromium/components/javascript_dialogs/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/ui.gni")

static_library("javascript_dialogs") {
  sources = [
    "app_modal_dialog_controller.cc",
    "app_modal_dialog_controller.h",
    "app_modal_dialog_manager.cc",
    "app_modal_dialog_manager.h",
    "app_modal_dialog_manager_delegate.h",
    "app_modal_dialog_queue.cc",
    "app_modal_dialog_queue.h",
    "app_modal_dialog_view.h",
    "extensions_client.h",
    "tab_modal_dialog_manager.cc",
    "tab_modal_dialog_manager.h",
    "tab_modal_dialog_manager_delegate.h",
    "tab_modal_dialog_view.h",
  ]

  deps = [
    "//base",
    "//base:i18n",
    "//components/navigation_metrics/",
    "//components/strings",
    "//components/ukm/content",
    "//components/url_formatter",
    "//content/public/browser",
    "//content/public/common",
    "//net",
    "//services/metrics/public/cpp:metrics_cpp",
    "//services/metrics/public/cpp:ukm_builders",
    "//skia",
    "//ui/base",
    "//ui/gfx",
    "//url:url",
  ]

  if (use_aura) {
    deps += [ "//ui/aura" ]
  }

  if (toolkit_views) {
    sources += [
      "views/app_modal_dialog_view_views.cc",
      "views/app_modal_dialog_view_views.h",
    ]

    if (is_chromeos_lacros) {
      sources += [
        "views/layer_dimmer.cc",
        "views/layer_dimmer.h",
      ]
    }

    deps += [
      "//build:chromeos_buildflags",
      "//ui/views",
    ]
  }

  if (is_android) {
    sources += [
      "android/app_modal_dialog_view_android.cc",
      "android/app_modal_dialog_view_android.h",
      "android/tab_modal_dialog_view_android.cc",
      "android/tab_modal_dialog_view_android.h",
    ]

    deps += [
      "//components/javascript_dialogs/android:jni_headers",
      "//ui/android",
    ]
  }
}

source_set("unit_tests") {
  testonly = true

  sources = [ "app_modal_dialog_manager_unittest.cc" ]

  deps = [
    ":javascript_dialogs",
    "//base",
    "//skia",
    "//testing/gmock",
    "//testing/gtest",
    "//url:url",
  ]

  if (is_chromeos_lacros) {
    sources += [ "views/layer_dimmer_unittest.cc" ]

    deps += [
      "//ui/aura",
      "//ui/compositor",
      "//ui/gfx/geometry",
    ]
  }
}