chromium/chrome/browser/ash/file_manager/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/chromeos/ui_mode.gni")

assert(is_chromeos_ash)

static_library("file_manager") {
  sources = [
    "app_id.h",
    "app_service_file_tasks.cc",
    "app_service_file_tasks.h",
    "cloud_upload_prefs_watcher.cc",
    "cloud_upload_prefs_watcher.h",
    "copy_or_move_encrypted_hook_delegate.cc",
    "copy_or_move_encrypted_hook_delegate.h",
    "copy_or_move_io_task.cc",
    "copy_or_move_io_task.h",
    "copy_or_move_io_task_impl.cc",
    "copy_or_move_io_task_impl.h",
    "copy_or_move_io_task_policy_impl.cc",
    "copy_or_move_io_task_policy_impl.h",
    "delete_io_task.cc",
    "delete_io_task.h",
    "documents_provider_root_manager.cc",
    "documents_provider_root_manager.h",
    "empty_trash_io_task.cc",
    "empty_trash_io_task.h",
    "extract_io_task.cc",
    "extract_io_task.h",
    "file_browser_handlers.cc",
    "file_browser_handlers.h",
    "file_manager_copy_or_move_hook_delegate.cc",
    "file_manager_copy_or_move_hook_delegate.h",
    "file_manager_copy_or_move_hook_file_check_delegate.cc",
    "file_manager_copy_or_move_hook_file_check_delegate.h",
    "file_manager_pref_names.cc",
    "file_manager_pref_names.h",
    "file_manager_string_util.cc",
    "file_manager_string_util.h",
    "file_tasks.cc",
    "file_tasks.h",
    "file_tasks_notifier.cc",
    "file_tasks_notifier.h",
    "file_tasks_notifier_factory.cc",
    "file_tasks_notifier_factory.h",
    "file_tasks_observer.h",
    "file_watcher.cc",
    "file_watcher.h",
    "fileapi_util.cc",
    "fileapi_util.h",
    "filesystem_api_util.cc",
    "filesystem_api_util.h",
    "fusebox_daemon.cc",
    "fusebox_daemon.h",
    "io_task.cc",
    "io_task.h",
    "io_task_controller.cc",
    "io_task_controller.h",
    "io_task_util.cc",
    "io_task_util.h",
    "office_file_tasks.cc",
    "office_file_tasks.h",
    "open_util.cc",
    "open_util.h",
    "open_with_browser.cc",
    "open_with_browser.h",
    "path_util.cc",
    "path_util.h",
    "prefs_migration_uma.h",
    "restore_io_task.cc",
    "restore_io_task.h",
    "restore_to_destination_io_task.cc",
    "restore_to_destination_io_task.h",
    "select_file_dialog_util.cc",
    "select_file_dialog_util.h",
    "snapshot_manager.cc",
    "snapshot_manager.h",
    "trash_common_util.cc",
    "trash_common_util.h",
    "trash_info_validator.cc",
    "trash_info_validator.h",
    "trash_io_task.cc",
    "trash_io_task.h",
    "uma_enums.gen.cc",
    "uma_enums.gen.h",
    "url_util.cc",
    "url_util.h",
    "virtual_file_tasks.cc",
    "virtual_file_tasks.h",
    "volume.cc",
    "volume.h",
    "volume_manager.cc",
    "volume_manager.h",
    "volume_manager_factory.cc",
    "volume_manager_factory.h",
    "volume_manager_observer.h",
    "zip_io_task.cc",
    "zip_io_task.h",
  ]

  public_deps = [
    "//ash/components/arc/mojom",
    "//base",
    "//chrome/browser:browser_public_dependencies",
    "//chrome/browser:primitives",
    "//chrome/browser/profiles:profile",
    "//chrome/services/file_util/public/cpp",
    "//chromeos/ash/components/dbus/cros_disks",
    "//chromeos/ash/components/disks",
    "//chromeos/ash/components/drivefs/mojom",
    "//chromeos/ash/components/file_manager",
    "//chromeos/ash/components/trash_service/public/cpp",
    "//components/download/content/public",
    "//components/drive",
    "//components/file_access",
    "//components/keyed_service/core",
    "//components/prefs",
    "//components/services/unzip/public/cpp",
    "//components/storage_monitor",
    "//mojo/public/cpp/bindings",
    "//services/device/public/mojom",
    "//skia:skia_core_public_headers",
    "//storage/browser",
    "//storage/common",
    "//ui/base/clipboard",
    "//ui/shell_dialogs",
    "//url",
  ]

  deps = [
    "//apps",
    "//ash",
    "//ash/components/arc:arc_base_utils",
    "//ash/components/arc:arc_features",
    "//ash/components/arc/mojom:notifications",
    "//ash/components/arc/session",
    "//ash/constants",
    "//ash/public/cpp",
    "//ash/webui/file_manager:constants",
    "//base:i18n",
    "//chrome/app:generated_resources",
    "//chrome/browser:browser_process",
    "//chrome/browser/apps/app_service:constants",
    "//chrome/browser/ash/app_list",
    "//chrome/browser/ash/app_list/search",
    "//chrome/browser/ash/arc/fileapi",
    "//chrome/browser/ash/bruschetta",
    "//chrome/browser/ash/crostini",
    "//chrome/browser/ash/drive",
    "//chrome/browser/ash/file_manager/virtual_tasks",
    "//chrome/browser/ash/fileapi",
    "//chrome/browser/ash/guest_os/public",
    "//chrome/browser/ash/login/demo_mode",
    "//chrome/browser/ash/policy/core",
    "//chrome/browser/ash/policy/dlp",
    "//chrome/browser/ash/policy/dlp/dialogs",
    "//chrome/browser/ash/profiles",
    "//chrome/browser/ash/smb_client",
    "//chrome/browser/chromeos/policy/dlp",
    "//chrome/browser/chromeos/upload_office_to_cloud",
    "//chrome/browser/profiles",
    "//chrome/browser/ui/webui/ash",
    "//chrome/browser/ui/webui/ash/cloud_upload:mojo_bindings_shared",
    "//chrome/browser/web_applications",
    "//chrome/common",
    "//chrome/common:chrome_features",
    "//chrome/common:constants",
    "//chrome/common:non_code_constants",
    "//chrome/common/extensions/api",
    "//chromeos/ash/components/browser_context_helper",
    "//chromeos/ash/components/drivefs",
    "//chromeos/components/disks:prefs",
    "//chromeos/constants",
    "//chromeos/dbus/power",
    "//components/download/public/common:public",
    "//components/pref_registry",
    "//components/services/app_service/public/cpp:app_types",
    "//components/services/unzip/content",
    "//components/services/unzip/public/mojom",
    "//components/strings:components_strings",
    "//components/user_manager",
    "//components/variations/service",
    "//content/public/browser",
    "//crypto",
    "//extensions/browser/api/file_handlers",
    "//extensions/common",
    "//google_apis/common",
    "//net",
    "//pdf:buildflags",
    "//services/network/public/cpp",
    "//third_party/blink/public/common:headers",
    "//third_party/re2",
    "//third_party/zlib/google:zip",
    "//ui/base",
    "//ui/base:types",
    "//ui/base/clipboard:clipboard_types",
    "//ui/base/clipboard:file_info",
    "//ui/base/data_transfer_policy",
    "//ui/chromeos/strings",
    "//ui/gfx",
    "//ui/gfx/codec",
  ]

  allow_circular_includes_from = [
    "//chrome/browser/ash/app_list",
    "//chrome/browser/ash/app_list/search",
    "//chrome/browser/ash/arc/fileapi",
    "//chrome/browser/ash/crostini",
    "//chrome/browser/ash/drive",
    "//chrome/browser/ash/file_manager/virtual_tasks",
    "//chrome/browser/ash/fileapi",
    "//chrome/browser/ash/guest_os/public",
    "//chrome/browser/ash/login/demo_mode",
    "//chrome/browser/ash/policy/dlp",
    "//chrome/browser/ash/smb_client",
    "//chrome/browser/ui/webui/ash",
  ]
}

static_library("test_support") {
  testonly = true

  sources = [
    "file_manager_test_util.cc",
    "file_manager_test_util.h",
    "mount_test_util.cc",
    "mount_test_util.h",
  ]

  public_deps = [
    ":file_manager",
    "//base",
    "//chrome/browser",
    "//chrome/browser/ash/drive:test_support",
    "//chrome/browser/ash/file_system_provider",
    "//chrome/browser/ash/file_system_provider:test_support",
    "//chromeos/ash/components/drivefs:test_support",
  ]

  deps = [
    "//base/test:test_support",
    "//chrome/browser/apps/app_service",
    "//chrome/browser/ash/drive",
    "//chrome/browser/ash/profiles",
    "//chrome/browser/extensions",
    "//chrome/browser/extensions:test_support",
    "//chrome/browser/ui",
    "//chrome/browser/ui/ash/system_web_apps",
    "//chrome/browser/ui/webui/ash/cloud_upload",
    "//chrome/common:constants",
    "//components/services/app_service/public/cpp:test_support",
    "//net",
    "//testing/gtest",
  ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "app_service_file_tasks_unittest.cc",
    "copy_or_move_io_task_policy_unittest.cc",
    "copy_or_move_io_task_unittest.cc",
    "delete_io_task_unittest.cc",
    "documents_provider_root_manager_unittest.cc",
    "empty_trash_io_task_unittest.cc",
    "file_manager_string_util_unittest.cc",
    "file_tasks_notifier_unittest.cc",
    "file_tasks_unittest.cc",
    "file_watcher_unittest.cc",
    "fileapi_util_unittest.cc",
    "io_task_controller_unittest.cc",
    "office_file_tasks_unittest.cc",
    "path_util_unittest.cc",
    "restore_io_task_unittest.cc",
    "restore_to_destination_io_task_unittest.cc",
    "trash_io_task_unittest.cc",
    "trash_unittest_base.cc",
    "trash_unittest_base.h",
    "uma_enums_unittest.cc",
    "url_util_unittest.cc",
    "virtual_file_tasks_unittest.cc",
    "volume_manager_unittest.cc",
  ]

  deps = [
    ":file_manager",
    ":test_support",
    "//ash",
    "//ash/components/arc:arc_base_utils",
    "//ash/components/arc:arc_features",
    "//ash/components/arc:arc_test_support",
    "//ash/components/arc:notification_test_support",
    "//ash/components/arc:prefs",
    "//ash/components/arc/session",
    "//ash/constants",
    "//base",
    "//base:i18n",
    "//base/test:test_support",
    "//chrome/browser",
    "//chrome/browser/apps/app_service",
    "//chrome/browser/apps/app_service:test_support",
    "//chrome/browser/ash/app_list/arc",
    "//chrome/browser/ash/arc/fileapi",
    "//chrome/browser/ash/crostini:test_support",
    "//chrome/browser/ash/drive",
    "//chrome/browser/ash/drive:test_support",
    "//chrome/browser/ash/file_manager/virtual_tasks",
    "//chrome/browser/ash/file_manager/virtual_tasks:test_support",
    "//chrome/browser/ash/file_manager/virtual_tasks:unit_tests",
    "//chrome/browser/ash/file_system_provider",
    "//chrome/browser/ash/file_system_provider:test_support",
    "//chrome/browser/ash/fileapi",
    "//chrome/browser/ash/fusebox",
    "//chrome/browser/ash/guest_os",
    "//chrome/browser/ash/guest_os/public",
    "//chrome/browser/ash/login/users:test_support",
    "//chrome/browser/ash/policy/dlp",
    "//chrome/browser/ash/policy/dlp/dialogs",
    "//chrome/browser/ash/policy/dlp/test:test_support",
    "//chrome/browser/ash/settings:test_support",
    "//chrome/browser/chromeos",
    "//chrome/browser/chromeos/policy/dlp",
    "//chrome/browser/chromeos/policy/dlp/dialogs",
    "//chrome/browser/chromeos/policy/dlp/test:test_support",
    "//chrome/browser/enterprise/connectors/test:test_support",
    "//chrome/browser/extensions",
    "//chrome/browser/extensions:test_support",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/ui",
    "//chrome/browser/ui/webui/ash/cloud_upload",
    "//chrome/browser/web_applications",
    "//chrome/common:chrome_features",
    "//chrome/common:constants",
    "//chrome/test:test_support",
    "//chrome/test:test_support_unit",
    "//chromeos/ash/components/dbus/chunneld",
    "//chromeos/ash/components/dbus/cicerone",
    "//chromeos/ash/components/dbus/cicerone:cicerone_proto_lib",
    "//chromeos/ash/components/dbus/concierge",
    "//chromeos/ash/components/dbus/cros_disks",
    "//chromeos/ash/components/dbus/seneschal",
    "//chromeos/ash/components/disks",
    "//chromeos/ash/components/disks:test_support",
    "//chromeos/ash/components/drivefs/mojom",
    "//chromeos/ash/components/settings",
    "//chromeos/ash/components/trash_service",
    "//chromeos/ash/components/trash_service/public/cpp",
    "//chromeos/ash/components/trash_service/public/mojom",
    "//chromeos/components/disks:prefs",
    "//chromeos/constants",
    "//chromeos/dbus/power",
    "//chromeos/dbus/power:power_manager_proto",
    "//components/account_id",
    "//components/drive",
    "//components/prefs",
    "//components/prefs:test_support",
    "//components/services/app_service/public/cpp:app_types",
    "//components/services/app_service/public/cpp:test_support",
    "//components/storage_monitor",
    "//components/sync_preferences:test_support",
    "//components/user_manager",
    "//components/user_manager:common",
    "//content/test:test_support",
    "//extensions:test_support",
    "//extensions/common",
    "//google_apis/drive",
    "//mojo/public/cpp/bindings",
    "//services/device/public/mojom",
    "//storage/browser",
    "//storage/browser:test_support",
    "//storage/common",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/blink/public/common:headers",
    "//third_party/blink/public/mojom:mojom_platform",
    "//ui/base/clipboard",
    "//ui/base/data_transfer_policy",
    "//ui/shell_dialogs",
    "//url",
  ]
}

source_set("browser_tests") {
  testonly = true

  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

  sources = [
    "external_filesystem_apitest.cc",
    "file_manager_browsertest.cc",
    "file_manager_browsertest_base.cc",
    "file_manager_browsertest_base.h",
    "file_manager_browsertest_utils.cc",
    "file_manager_browsertest_utils.h",
    "file_manager_jstest.cc",
    "file_manager_jstest_base.cc",
    "file_manager_jstest_base.h",
    "file_manager_policy_browsertest.cc",
    "file_tasks_browsertest.cc",
    "image_loader_jstest.cc",
    "open_with_browser_browsertest.cc",
  ]

  deps = [
    ":file_manager",
    ":test_support",
    "//ash",
    "//ash:test_support",
    "//ash/components/arc:arc_base_utils",
    "//ash/components/arc:arc_features",
    "//ash/components/arc:arc_test_support",
    "//ash/components/arc:notification_test_support",
    "//ash/components/arc/mojom",
    "//ash/components/arc/session",
    "//ash/components/arc/session:connection_holder",
    "//ash/constants",
    "//ash/public/cpp",
    "//ash/webui/common:trusted_types_util",
    "//ash/webui/file_manager:constants",
    "//ash/webui/file_manager:file_manager_ui",
    "//ash/webui/file_manager/resources:file_manager_swa_resources",
    "//ash/webui/system_apps/public:system_web_app_type",
    "//base",
    "//base:base_static",
    "//base/test:test_support",
    "//build:branding_buildflags",
    "//build/config/coverage:buildflags",
    "//chrome/browser",
    "//chrome/browser:browser_process",
    "//chrome/browser/apps/app_service",
    "//chrome/browser/apps/app_service:app_registry_cache_waiter",
    "//chrome/browser/apps/app_service:constants",
    "//chrome/browser/apps/app_service:test_support",
    "//chrome/browser/ash/app_list/search",
    "//chrome/browser/ash/app_list/search/local_image_search",
    "//chrome/browser/ash/arc/fileapi",
    "//chrome/browser/ash/base",
    "//chrome/browser/ash/crosapi",
    "//chrome/browser/ash/crosapi:test_support",
    "//chrome/browser/ash/crostini:test_support",
    "//chrome/browser/ash/drive",
    "//chrome/browser/ash/drive:test_support",
    "//chrome/browser/ash/extensions/file_manager",
    "//chrome/browser/ash/file_system_provider",
    "//chrome/browser/ash/file_system_provider:test_support",
    "//chrome/browser/ash/guest_os",
    "//chrome/browser/ash/guest_os/public",
    "//chrome/browser/ash/login/test:test_support",
    "//chrome/browser/ash/policy/dlp",
    "//chrome/browser/ash/policy/dlp/dialogs",
    "//chrome/browser/ash/policy/dlp/test:test_support",
    "//chrome/browser/ash/settings",
    "//chrome/browser/ash/settings:test_support",
    "//chrome/browser/ash/smb_client",
    "//chrome/browser/ash/system_web_apps",
    "//chrome/browser/chromeos",
    "//chrome/browser/chromeos/policy/dlp",
    "//chrome/browser/chromeos/policy/dlp/test:test_support",
    "//chrome/browser/chromeos/upload_office_to_cloud",
    "//chrome/browser/enterprise/connectors/test:test_support",
    "//chrome/browser/extensions",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/ui",
    "//chrome/browser/ui/ash",
    "//chrome/browser/ui/ash/cast_config",
    "//chrome/browser/ui/ash/sharesheet",
    "//chrome/browser/ui/ash/system_web_apps",
    "//chrome/browser/ui/webui/ash/cloud_upload",
    "//chrome/browser/ui/webui/ash/office_fallback",
    "//chrome/browser/web_applications",
    "//chrome/browser/web_applications:web_applications_test_support",
    "//chrome/common:chrome_features",
    "//chrome/common:constants",
    "//chrome/common:non_code_constants",
    "//chrome/test:test_support",
    "//chrome/test:test_support_ui",
    "//chromeos/ash/components/browser_context_helper",
    "//chromeos/ash/components/dbus:vm_applications_apps_proto",
    "//chromeos/ash/components/dbus/cros_disks",
    "//chromeos/ash/components/dbus/shill",
    "//chromeos/ash/components/dbus/spaced",
    "//chromeos/ash/components/disks",
    "//chromeos/ash/components/drivefs",
    "//chromeos/ash/components/drivefs:test_support",
    "//chromeos/ash/components/drivefs/mojom",
    "//chromeos/ash/components/settings",
    "//chromeos/ash/components/smbfs",
    "//chromeos/ash/components/smbfs/mojom",
    "//chromeos/constants",
    "//chromeos/crosapi/mojom",
    "//chromeos/dbus/constants",
    "//chromeos/dbus/dlp",
    "//chromeos/dbus/dlp:dlp_proto",
    "//components/account_id",
    "//components/download/public/common:public",
    "//components/drive",
    "//components/file_access:test_support",
    "//components/keyed_service/core",
    "//components/media_router/browser:test_support",
    "//components/policy/core/common:test_support",
    "//components/prefs",
    "//components/services/app_service/public/cpp:app_types",
    "//components/services/app_service/public/cpp:instance_update",
    "//components/services/app_service/public/cpp:test_support",
    "//components/session_manager/core",
    "//components/signin/public/identity_manager",
    "//components/signin/public/identity_manager:test_support",
    "//components/user_manager",
    "//components/variations/service",
    "//components/webapps/common",
    "//content/test:test_support",
    "//extensions:test_support",
    "//extensions/browser:test_support",
    "//extensions/browser/api/file_handlers",
    "//extensions/browser/api/test",
    "//extensions/common",
    "//extensions/common:mojom",
    "//google_apis/common:test_support",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/bindings:bindings_base",
    "//net",
    "//net:test_support",
    "//pdf:buildflags",
    "//services/network:test_support",
    "//storage/browser",
    "//storage/common",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/blink/public/common:headers",
    "//ui/aura",
    "//ui/base",
    "//ui/events",
    "//ui/events:event_constants",
    "//ui/events/types:headers",
    "//ui/file_manager:file_manager_gen_resources",
    "//ui/file_manager:resources",
    "//ui/gfx/geometry",
    "//ui/message_center/public/cpp",
    "//ui/shell_dialogs",
    "//ui/views",
    "//url",
  ]
}

if (!is_chromeos_device) {
  source_set("interactive_ui_tests") {
    testonly = true

    defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

    sources = [ "file_manager_interactive_uitest.cc" ]

    deps = [
      ":file_manager",
      "//ash",
      "//ash/public/cpp",
      "//base/test:test_support",
      "//chrome/browser",
      "//chrome/browser/apps/app_service",
      "//chrome/browser/ash/system_web_apps",
      "//chrome/browser/ui/ash",
      "//chrome/browser/ui/ash/default_pinned_apps",
      "//chrome/test:test_support_ui",
      "//chrome/test/base/ash/interactive:test_support",
      "//content/test:test_support",
      "//extensions/browser",
      "//testing/gtest",
      "//ui/aura",
      "//ui/aura:test_support",
      "//ui/base:test_support",
    ]
  }
}