chromium/components/open_from_clipboard/BUILD.gn

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

static_library("open_from_clipboard") {
  sources = [
    "clipboard_recent_content.cc",
    "clipboard_recent_content.h",
  ]

  deps = [
    ":open_from_clipboard_impl",
    "//base",
    "//components/variations",
    "//net",
    "//ui/base:base",
    "//url",
  ]

  public_deps = [ ":feature_flags" ]

  if (!is_ios) {
    sources += [
      "clipboard_recent_content_generic.cc",
      "clipboard_recent_content_generic.h",
    ]
    deps += [ "//ui/base/clipboard" ]
  } else {
    sources += [
      "clipboard_recent_content_ios.h",
      "clipboard_recent_content_ios.mm",
    ]
  }
}

source_set("feature_flags") {
  sources = [
    "clipboard_recent_content_features.cc",
    "clipboard_recent_content_features.h",
  ]
  deps = [ "//base" ]
}

# Helper classes used by "open_from_clipboard" target. These classes must have
# no dependencies on "//base:i18n".
source_set("open_from_clipboard_impl") {
  sources = []
  deps = [ "//base" ]
  assert_no_deps = [ "//base:i18n" ]
  if (is_ios) {
    sources += [
      "clipboard_async_wrapper_ios.h",
      "clipboard_async_wrapper_ios.mm",
      "clipboard_recent_content_impl_ios.h",
      "clipboard_recent_content_impl_ios.mm",
    ]
    frameworks = [ "MobileCoreServices.framework" ]
  }
}

static_library("test_support") {
  testonly = true
  sources = [
    "fake_clipboard_recent_content.cc",
    "fake_clipboard_recent_content.h",
  ]

  deps = [
    ":open_from_clipboard",
    "//base",
    "//ui/gfx:gfx",
    "//url",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = []

  deps = [
    ":open_from_clipboard",
    ":open_from_clipboard_impl",
    "//base",
    "//base/test:test_support",
    "//testing/gtest",
    "//ui/base:test_support",
    "//ui/gfx:test_support",
    "//url",
  ]

  if (!is_ios) {
    sources += [ "clipboard_recent_content_generic_unittest.cc" ]
    deps += [
      ":feature_flags",
      "//base/test:test_support",
      "//ui/base/clipboard:clipboard_test_support",
    ]
  } else {
    sources += [ "clipboard_recent_content_ios_unittest.mm" ]
  }
}