# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("///build/config/ozone.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/jumbo.gni") import("//build/config/ui.gni") jumbo_component("clipboard_types") { output_name = "ui_base_clipboard_types" sources = [ "clipboard_buffer.h", "clipboard_constants.cc", "clipboard_constants.h", ] if (!is_ios) { sources += [ "clipboard_format_type.h" ] } if (is_android && !use_qt) { sources += [ "clipboard_format_type_android.cc" ] } if (is_mac && !use_qt) { sources += [ "clipboard_format_type_mac.mm" ] } if (is_apple) { sources += [ "clipboard_constants_mac.mm" ] } if (is_win && !use_qt) { sources += [ "clipboard_format_type_win.cc" ] } if (use_aura || use_qt) { if ((use_x11 && is_linux) || !is_win || use_qt) { sources += [ "clipboard_format_type_aura.cc" ] } } defines = [ "IS_UI_BASE_CLIPBOARD_TYPES_IMPL" ] deps = [ "//base" ] frameworks = [] if (is_apple && !use_qt) { frameworks += [ "Foundation.framework" ] } if (is_mac && !use_qt) { frameworks += [ "AppKit.framework" ] } } jumbo_component("clipboard") { output_name = "ui_base_clipboard" sources = [ "clipboard.cc", "clipboard.h", "clipboard_metrics.cc", "clipboard_metrics.h", "clipboard_monitor.cc", "clipboard_monitor.h", "clipboard_observer.cc", "clipboard_observer.h", "custom_data_helper.cc", "custom_data_helper.h", "scoped_clipboard_writer.cc", "scoped_clipboard_writer.h", ] if (is_android && !use_qt) { sources += [ "clipboard_android.cc", "clipboard_android.h", ] } if (is_mac) { sources += [ "clipboard_mac.h", "clipboard_mac.mm", "clipboard_util_mac.h", "clipboard_util_mac.mm", ] } if (is_win && !use_qt) { sources += [ "clipboard_util_win.cc", "clipboard_util_win.h", "clipboard_win.cc", "clipboard_win.h", ] } defines = [ "IS_UI_BASE_CLIPBOARD_IMPL" ] deps = [ "//base", "//mojo/public/cpp/base", "//net", "//skia", "//ui/base:features", "//ui/gfx", "//ui/gfx/geometry", ] public_deps = [ ":clipboard_types", "//ui/base/data_transfer_policy", ] if (use_aura && !use_qt) { # Linux clipboard implementations. if (is_linux && !is_chromecast) { sources += [ "clipboard_linux.cc" ] if (use_ozone) { sources += [ "clipboard_ozone.cc", "clipboard_ozone.h", ] deps += [ "//ui/base" ] } if (use_x11) { sources += [ "clipboard_x11.cc", "clipboard_x11.h", ] deps += [ "//ui/base", "//ui/base/x", "//ui/events/platform", "//ui/events/platform/x11", "//ui/events/x", "//ui/gfx/x", ] } } else if (is_chromeos && ozone_platform_x11) { # linux-chromeos uses non-backed clipboard by default, but supports ozone # x11 with flag --use-system-clipbboard. sources += [ "clipboard_data.cc", "clipboard_data.h", "clipboard_non_backed.cc", "clipboard_non_backed.h", "clipboard_ozone.cc", "clipboard_ozone.h", ] deps += [ "//ui/base" ] } else if (!is_win) { # This file is used for all builds not backed by an underlying platform. sources += [ "clipboard_data.cc", "clipboard_data.h", "clipboard_non_backed.cc", "clipboard_non_backed.h", ] } } if (is_android) { deps += [ "//ui/base:ui_base_jni_headers" ] } if (is_mac && !use_qt) { deps += [ "//third_party/mozilla" ] frameworks = [ "AppKit.framework", "CoreFoundation.framework", ] } if (use_ozone) { deps += [ "//ui/ozone" ] } if (use_qt && is_mac) { sources -= [ "clipboard_mac.h", "clipboard_mac.mm" ] } } jumbo_source_set("clipboard_test_support") { testonly = true if (!is_ios) { sources = [ "test/clipboard_test_util.cc", "test/clipboard_test_util.h", "test/test_clipboard.cc", "test/test_clipboard.h", ] } if (is_android) { sources += [ "clipboard_android_test_support.cc" ] } public_deps = [ ":clipboard", "//base", "//skia", ] deps = [ "//base/test:test_support" ] if (is_android) { deps += [ "//ui/android:ui_javatest_jni_headers" ] } } source_set("clipboard_test") { testonly = true sources = [] output_name = "ui_base_clipboard_test" if (!is_ios) { sources += [ "custom_data_helper_unittest.cc", "test/test_clipboard_unittest.cc", ] } if (is_mac) { sources += [ "clipboard_mac_unittest.mm", "clipboard_util_mac_unittest.mm", ] } if (use_aura && !chromeos_is_browser_only && !use_x11 && !is_win && !use_ozone) { sources += [ "clipboard_data_unittest.cc", "clipboard_non_backed_unittest.cc", ] } deps = [ ":clipboard_test_support", "//base/test:test_support", "//testing/gmock", "//testing/gtest", "//ui/events/platform", "//ui/gfx:test_support", "//url:url", ] if (is_mac) { deps += [ "//third_party/mozilla" ] } }