chromium/remoting/host/file_transfer/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("//build/config/chromeos/ui_mode.gni")
import("//remoting/build/config/remoting_build.gni")

source_set("file_transfer") {
  sources = []

  public_deps = [ ":common" ]

  deps = [
    "//base",
    "//remoting/resources",
  ]

  if (is_mac) {
    sources += [ "file_chooser_mac.mm" ]
    deps += [ "//ui/base" ]
    frameworks = [ "AppKit.framework" ]
  } else if (is_win) {
    sources += [
      "file_chooser_common_win.h",
      "file_chooser_main_win.cc",
      "file_chooser_win.cc",
    ]
    deps += [
      "//ipc:ipc",
      "//remoting/host:common",
      "//remoting/host/base",
      "//remoting/host/mojom",
      "//remoting/host/win",
    ]
  } else if (is_chromeos_ash) {
    deps += [
      ":file_chooser_chromeos",
      "//remoting/host/chromeos",
    ]
  } else if (is_linux) {
    sources += [ "file_chooser_linux.cc" ]
    deps += [
      "//build/config/linux/gtk",
      "//ui/base",
    ]
  }
}

source_set("common") {
  public = [
    "buffered_file_writer.h",
    "directory_helpers.h",
    "ensure_user.h",
    "file_chooser.h",
    "file_operations.h",
    "file_transfer_message_handler.h",
    "ipc_file_operations.h",
    "local_file_operations.h",
    "rtc_log_file_operations.h",
    "session_file_operations_handler.h",
  ]

  sources = [
    "buffered_file_writer.cc",
    "file_transfer_message_handler.cc",
    "ipc_file_operations.cc",
    "local_file_operations.cc",
    "rtc_log_file_operations.cc",
    "session_file_operations_handler.cc",
  ]

  deps = [
    "//base",
    "//net:net",
    "//remoting/base",
    "//remoting/host/mojom",
    "//remoting/protocol",
    "//ui/base",
    "//url:url",
  ]

  if (is_mac) {
    sources += [
      "directory_helpers.cc",
      "ensure_user_mac.cc",
    ]
  } else if (is_win) {
    sources += [
      "directory_helpers_win.cc",
      "ensure_user_win.cc",
    ]
  } else if (is_chromeos) {
    sources += [
      "directory_helpers.cc",
      "ensure_user_no_op.cc",
    ]
    deps += [ "//chrome/common:constants" ]
  } else {
    sources += [
      "directory_helpers.cc",
      "ensure_user_no_op.cc",
    ]
  }
}

if (is_chromeos_ash) {
  source_set("file_chooser_chromeos") {
    sources = [
      "file_chooser_chromeos.cc",
      "file_chooser_chromeos.h",
    ]
    deps = [
      ":common",
      "//remoting/host/chromeos:chromeos",
      "//remoting/resources",
      "//ui/display",
      "//ui/shell_dialogs",
    ]
  }
}

source_set("test_support") {
  testonly = true

  sources = [
    "fake_file_operations.cc",
    "fake_file_operations.h",
    "test_byte_vector_utils.h",
  ]
  deps = [
    ":common",
    "//base",
    "//remoting/protocol",
  ]
  public_deps = []

  if (is_chromeos_ash) {
    public_deps += [ ":file_chooser_chromeos" ]
  } else {
    sources += [
      "fake_file_chooser.cc",
      "fake_file_chooser.h",
    ]
  }
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "buffered_file_writer_unittest.cc",
    "file_transfer_message_handler_unittest.cc",
    "rtc_log_file_operations_unittest.cc",
  ]

  deps = [
    ":common",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//net:net",
    "//remoting/base",
    "//remoting/host/mojom",
    "//remoting/protocol",
    "//remoting/protocol:test_support",
    "//testing/gtest",
  ]

  if (is_chromeos_ash) {
    sources += [ "file_chooser_chromeos_unittest.cc" ]
    deps += [
      "//content/test:test_support",
      "//remoting/host/chromeos:chromeos",
      "//remoting/host/chromeos:unit_tests",
      "//ui/shell_dialogs",
    ]
  } else {
    sources += [
      "ipc_file_operations_unittest.cc",
      "local_file_operations_unittest.cc",
    ]
  }
}