chromium/remoting/host/remote_open_url/BUILD.gn

# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//remoting/build/config/remoting_build.gni")

source_set("common") {
  sources = [
    "remote_open_url_client.cc",
    "remote_open_url_client.h",
    "remote_open_url_constants.cc",
    "remote_open_url_constants.h",
    "remote_open_url_message_handler.cc",
    "remote_open_url_message_handler.h",
    "remote_open_url_util.cc",
    "remote_open_url_util.h",
    "url_forwarder_configurator.cc",
    "url_forwarder_configurator.h",
    "url_forwarder_control_message_handler.cc",
    "url_forwarder_control_message_handler.h",
  ]

  deps = [
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/platform",
    "//mojo/public/cpp/system",
    "//remoting/base",
    "//remoting/host:chromoting_host_services_client",
    "//remoting/host:resources",
    "//remoting/host:settings",
    "//remoting/host/base",
    "//remoting/host/mojom",
    "//remoting/protocol",
    "//remoting/resources",
    "//ui/base",
  ]

  public_deps = [
    "//base",
    "//remoting/proto",
  ]

  if (is_linux) {
    sources += [
      "remote_open_url_client_delegate_linux.cc",
      "remote_open_url_client_delegate_linux.h",
      "url_forwarder_configurator_linux.cc",
      "url_forwarder_configurator_linux.h",
    ]

    deps += [ "//build/config/linux/gtk" ]
  }

  if (is_win) {
    sources += [
      "remote_open_url_client_delegate_win.cc",
      "remote_open_url_client_delegate_win.h",
      "url_forwarder_configurator_main_win.cc",
      "url_forwarder_configurator_win.cc",
      "url_forwarder_configurator_win.h",
    ]

    deps += [ "//remoting/host/win" ]
  }
}

source_set("remote_open_url_main_headers") {
  sources = [ "remote_open_url_main.h" ]
  deps = [ "//remoting/host:host_main_headers" ]
}

source_set("main") {
  configs += [ "//remoting/build/config:host_implementation" ]

  sources = [ "remote_open_url_main.cc" ]
  deps = [
    ":common",
    ":remote_open_url_main_headers",
    "//base",
    "//base:i18n",
    "//mojo/core/embedder",
    "//remoting/base",
    "//remoting/base:breakpad",
    "//remoting/host",
    "//remoting/host:chromoting_host_services_client",
    "//remoting/host:resources",
    "//remoting/host:settings",
    "//remoting/host/base",
    "//remoting/host/mojom",
    "//ui/base",
    "//url",
  ]
}

static_library("test_support") {
  testonly = true

  sources = [
    "fake_url_forwarder_configurator.cc",
    "fake_url_forwarder_configurator.h",
  ]

  deps = [ ":common" ]
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "remote_open_url_client_unittest.cc",
    "remote_open_url_message_handler_unittest.cc",
  ]

  deps = [
    ":common",
    "//base/test:test_support",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/platform",
    "//net",
    "//remoting/base",
    "//remoting/host:test_support",
    "//remoting/host/mojom",
    "//remoting/proto",
    "//remoting/protocol:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]
}

if (enable_me2me_host && (is_linux || is_win)) {
  executable("remote_open_url") {
    sources = [ "remote_open_url_entry_point.cc" ]
    deps = [
      ":remote_open_url_main_headers",
      "//remoting/host:remoting_core",
    ]
    configs += [ "//build/config/compiler:wexit_time_destructors" ]

    if (is_win) {
      sources += [ "$root_gen_dir/remoting/version.rc" ]

      defines =
          host_predefines + [ "REMOTING_HOST_BINARY=BINARY_REMOTE_OPEN_URL" ]

      deps += [
        "//build/win:default_exe_manifest",
        "//remoting/host/win:remoting_windows_resources",
      ]
    }
  }
}