chromium/chrome/browser/web_applications/app_service/BUILD.gn

# Copyright 2018 The Chromium Authors
# 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")

source_set("app_service") {
  sources = [
    "publisher_helper.cc",
    "publisher_helper.h",
    "web_app_publisher_helper.cc",
    "web_app_publisher_helper.h",
  ]

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

  # TODO(crbug.com/40251079): Remove circular dependencies.
  allow_circular_includes_from = [ "//chrome/browser/apps/app_service" ]

  public_deps = [
    "//chrome/browser:browser_public_dependencies",
    "//chrome/browser/media/webrtc",
  ]

  deps = [
    "//base",
    "//chrome/browser/apps/app_service",
    "//chrome/browser/apps/app_service/app_icon",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/web_applications",
    "//chrome/common",
    "//components/content_settings/core/browser",
    "//components/services/app_service",
    "//components/sessions",
    "//components/webapps/browser",
    "//components/webapps/common",
    "//url",
  ]

  if (is_chromeos) {
    deps += [ "//chrome/browser/apps/browser_instance" ]
    allow_circular_includes_from += [ "//chrome/browser/apps/browser_instance" ]
  }

  if (is_chromeos_ash) {
    deps += [
      "//ash/components/arc:arc_base",
      "//ash/public/cpp",
      "//ash/webui/projector_app/public/cpp",
      "//ash/webui/system_apps/public:system_web_app_type",
      "//chrome/browser/apps/almanac_api_client",
      "//chrome/browser/ash/crosapi:browser_util",
      "//chrome/browser/ash/file_manager",
      "//chrome/browser/ash/guest_os",
      "//chrome/browser/ash/login/demo_mode",
      "//chrome/browser/ash/mall",
      "//chrome/browser/ash/system_web_apps",
      "//chrome/browser/ash/system_web_apps/types",
      "//chrome/browser/chromeos",
      "//components/app_restore",
      "//components/services/app_service/public/cpp:instance_update",
      "//extensions/browser/api/file_handlers",
    ]
  }

  if (is_chromeos_lacros) {
    sources += [
      "lacros_web_apps_controller.cc",
      "lacros_web_apps_controller.h",
    ]

    deps += [
      "//chromeos/constants",
      "//chromeos/crosapi/mojom",
      "//chromeos/lacros",
      "//chromeos/startup",
    ]
  }
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "web_app_publisher_helper_unittest.cc",
    "web_app_publisher_unittest.cc",
  ]

  deps = [
    ":app_service",
    "//chrome/browser/apps/app_service",
    "//chrome/browser/apps/app_service:app_registry_cache_waiter",
    "//chrome/browser/apps/app_service:test_support",
    "//chrome/browser/apps/app_service/app_icon",
    "//chrome/browser/apps/app_service/app_icon:test_support",
    "//chrome/browser/web_applications",
    "//chrome/browser/web_applications:web_applications_test_support",
    "//chrome/test:test_support",
    "//components/services/app_service",
    "//components/webapps/browser",
    "//components/webapps/common",
    "//content/public/common",
    "//testing/gtest",
  ]

  if (is_chromeos_ash) {
    deps += [ "//chromeos/ash/components/system" ]
  }

  if (is_chromeos_lacros) {
    deps += [
      ":test_support",
      "//chromeos/lacros",
      "//chromeos/startup",
    ]
  }
}

source_set("test_support") {
  testonly = true

  sources = []
  deps = []

  if (is_chromeos_lacros) {
    sources += [
      "test/loopback_crosapi_app_service_proxy.cc",
      "test/loopback_crosapi_app_service_proxy.h",
    ]

    deps += [
      ":app_service",
      "//base",
      "//build:chromeos_buildflags",
      "//chrome/browser/apps/app_service",
      "//chromeos/crosapi/mojom",
      "//components/services/app_service",
      "//mojo/public/cpp/bindings",
    ]
  }
}