chromium/ios/chrome/browser/shared/ui/util/BUILD.gn

# Copyright 2016 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/buildflag_header.gni")
import("//build/config/apple/swift_source_set.gni")
import("//ios/build/chrome_build.gni")

source_set("util") {
  sources = [
    "accessibility_close_menu_button.h",
    "accessibility_close_menu_button.mm",
    "animation_util.h",
    "animation_util.mm",
    "attributed_string_util.h",
    "attributed_string_util.mm",
    "dynamic_type_util.h",
    "dynamic_type_util.mm",
    "keyboard_observer_helper.h",
    "keyboard_observer_helper.mm",
    "layout_guide_names.h",
    "layout_guide_names.mm",
    "named_guide.h",
    "named_guide.mm",
    "optional_property_animator.h",
    "optional_property_animator.mm",
    "page_animation_util.h",
    "page_animation_util.mm",
    "pasteboard_util.h",
    "pasteboard_util.mm",
    "property_animator_group.h",
    "property_animator_group.mm",
    "reversed_animation.h",
    "reversed_animation.mm",
    "rtl_geometry.h",
    "rtl_geometry.mm",
    "top_view_controller.h",
    "top_view_controller.mm",
    "transparent_link_button.h",
    "transparent_link_button.mm",
    "uikit_ui_util.h",
    "uikit_ui_util.mm",
  ]
  deps = [
    "//base",
    "//base:i18n",
    "//components/open_from_clipboard:open_from_clipboard_impl",
    "//ios/chrome/app:tests_hook",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/shared/public/features",
    "//ios/chrome/browser/shared/public/features:system_flags",
    "//ios/chrome/browser/shared/ui/symbols",
    "//ios/chrome/browser/shared/ui/util/image",
    "//ios/chrome/common:timing",
    "//ios/chrome/common/ui/util",
    "//ios/chrome/common/ui/util:dynamic_type_util",
    "//ios/web:threads",
    "//ios/web/common:uikit",
    "//ios/web/public/thread:thread",
    "//ios/web/thread",
    "//net",
    "//ui/base",
    "//ui/gfx",
    "//url",
  ]
  frameworks = [
    "Accelerate.framework",
    "CoreGraphics.framework",
    "QuartzCore.framework",
    "UniformTypeIdentifiers.framework",
  ]
}

source_set("snackbar_util") {
  sources = [
    "snackbar_util.h",
    "snackbar_util.mm",
  ]
  deps = [
    "//base",
    "//ios/chrome/app:tests_hook",
    "//ios/chrome/browser/shared/ui/util/identity_snackbar",
    "//ios/third_party/material_components_ios",
  ]
  frameworks = [ "UIKit.framework" ]
}

source_set("util_bridge") {
  sources = [
    "uikit_ui_util_bridge.h",
    "uikit_ui_util_bridge.mm",
  ]
  deps = [ ":util" ]
}

swift_source_set("util_swift") {
  sources = [
    "UIView+WindowCoordinates.swift",
    "UIView+WindowObserving.swift",
    "frame_layout_guide.swift",
    "layout_guide_center.swift",
  ]
  frameworks = [ "UIKit.framework" ]
}

swift_source_set("util_swiftui") {
  sources = [ "ConditionalViewModifier.swift" ]
  deps = []
  frameworks = [ "SwiftUI.framework" ]
}

source_set("terms_util") {
  sources = [
    "terms_util.h",
    "terms_util.mm",
  ]
  deps = [
    "//base",
    "//components/resources:terms_resources",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/shared/model/application_context",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ui/base",
    "//url",
  ]
}

source_set("omnibox_util") {
  sources = [
    "omnibox_util.h",
    "omnibox_util.mm",
  ]
  deps = [
    ":util",
    ":util_swift",
    "//base",
    "//components/resources:terms_resources",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/omnibox/model",
    "//ios/chrome/browser/shared/coordinator/layout_guide",
    "//ios/chrome/browser/shared/model/browser",
    "//ui/base",
    "//url",
  ]
}

source_set("url_with_title") {
  sources = [
    "url_with_title.h",
    "url_with_title.mm",
  ]
  deps = [ "//url" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "frame_layout_guide_unittest.mm",
    "layout_guide_center_unittest.mm",
    "named_guide_unittest.mm",
    "optional_property_animator_unittest.mm",
    "pasteboard_util_unittest.mm",
    "rtl_geometry_unittest.mm",
    "terms_util_unittest.mm",
    "uikit_ui_util_unittest.mm",
    "uiview_window_coordinates_unittest.mm",
    "uiview_window_observing_unittest.mm",
  ]
  deps = [
    ":terms_util",
    ":util",
    ":util_swift",
    "//base",
    "//base/test:test_support",
    "//ios/chrome/browser/shared/public/features",
    "//ios/third_party/material_components_ios",
    "//testing/gtest",
    "//third_party/ocmock",
    "//ui/base",
    "//url",
  ]
}

source_set("eg_app_support+eg2") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [
    "keyboard_observer_helper_app_interface.h",
    "keyboard_observer_helper_app_interface.mm",
  ]
  deps = [
    ":util",
    "//base",
    "//base/test:test_support",
    "//ios/chrome/test/app:test_support",
  ]
}

source_set("eg_test_support+eg2") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [ "keyboard_observer_helper_app_interface.h" ]
  deps = [
    ":util",
    "//ios/testing/earl_grey:eg_test_support+eg2",
  ]
}

source_set("eg2_tests") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [ "omnibox_util_egtest.mm" ]
  deps = [
    "//ios/chrome/browser/shared/model/prefs:pref_names",
    "//ios/chrome/test/earl_grey:eg_test_support+eg2",
    "//ios/testing/earl_grey:eg_test_support+eg2",
    "//net:test_support",
  ]
  frameworks = [ "UIKit.framework" ]
}