chromium/ios/chrome/browser/ui/omnibox/BUILD.gn

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

source_set("omnibox") {
  sources = [
    "omnibox_controller_delegate.h",
    "omnibox_focus_delegate.h",
    "web_location_bar.cc",
    "web_location_bar.h",
  ]
  deps = [
    "//base",
    "//components/omnibox/browser",
    "//components/search_engines",
    "//ui/base",
  ]
}

source_set("omnibox_popup_shared") {
  sources = [
    "omnibox_constants.h",
    "omnibox_constants.mm",
    "omnibox_keyboard_delegate.h",
  ]
}

# This util file must be separate from the below
# omnibox_util file because it is used in showcase. This
# means that its dependencies should be limited, avoiding
# components code.
source_set("omnibox_suggestion_icon_util") {
  sources = [
    "omnibox_suggestion_icon_util.h",
    "omnibox_suggestion_icon_util.mm",
  ]
  deps = [
    "//base",
    "//ios/chrome/browser/shared/ui/symbols",
    "//ios/chrome/browser/shared/ui/symbols:buildflags",
  ]
}

# See the comment above on omnibox_suggestion_icon_util
# for why these two targets are separated.
source_set("omnibox_util") {
  sources = [
    "omnibox_metrics_helper.h",
    "omnibox_metrics_helper.mm",
    "omnibox_text_change_delegate.h",
    "omnibox_text_field_delegate.h",
    "omnibox_util.h",
    "omnibox_util.mm",
  ]
  deps = [
    ":features",
    ":omnibox_suggestion_icon_util",
    "//base",
    "//components/omnibox/browser",
    "//components/safe_browsing/core/common:common",
    "//components/security_state/core",
    "//ios/chrome/browser/shared/public/features",
    "//ios/chrome/browser/shared/ui/symbols",
    "//third_party/omnibox_proto",
  ]
  public_deps = [
    ":omnibox_icon_type_constants",
    "//ios/chrome/app/theme",
  ]
}

# This target can also be used on EG2 tests, so it should only contain constants
source_set("omnibox_icon_type_constants") {
  sources = [
    "omnibox_icon_type.h",
    "omnibox_icon_type.mm",
  ]
  deps = [
    "//base",
    "//ios/chrome/browser/shared/ui/symbols",
  ]
}

source_set("omnibox_internal") {
  sources = [
    "chrome_omnibox_client_ios.h",
    "chrome_omnibox_client_ios.mm",
    "fake_suggestions_database.cc",
    "fake_suggestions_database.h",
    "omnibox_consumer.h",
    "omnibox_container_view.h",
    "omnibox_container_view.mm",
    "omnibox_coordinator.h",
    "omnibox_coordinator.mm",
    "omnibox_mediator.h",
    "omnibox_mediator.mm",
    "omnibox_return_key_forwarding_delegate.h",
    "omnibox_return_key_forwarding_delegate.mm",
    "omnibox_text_field_ios.h",
    "omnibox_text_field_ios.mm",
    "omnibox_text_field_paste_delegate.h",
    "omnibox_text_field_paste_delegate.mm",
    "omnibox_view_consumer.h",
    "omnibox_view_controller.h",
    "omnibox_view_controller.mm",
    "omnibox_view_ios.h",
    "omnibox_view_ios.mm",
    "text_field_view_containing.h",
    "web_location_bar_impl.h",
    "web_location_bar_impl.mm",
    "zero_suggest_prefetch_helper.h",
    "zero_suggest_prefetch_helper.mm",
  ]
  deps = [
    ":features",
    ":omnibox",
    ":omnibox_popup_shared",
    ":omnibox_suggestion_icon_util",
    ":omnibox_util",
    "//base",
    "//components/favicon/ios",
    "//components/feature_engagement/public",
    "//components/open_from_clipboard:",
    "//components/resources",
    "//components/search_engines",
    "//components/security_state/core",
    "//components/strings",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/autocomplete/model",
    "//ios/chrome/browser/bookmarks/model",
    "//ios/chrome/browser/bookmarks/model:model_utils",
    "//ios/chrome/browser/default_browser/model:default_browser_interest_signals",
    "//ios/chrome/browser/default_promo/ui_bundled:coordinator",
    "//ios/chrome/browser/favicon/model",
    "//ios/chrome/browser/feature_engagement/model",
    "//ios/chrome/browser/https_upgrades/model",
    "//ios/chrome/browser/intents:intents_donation_helper",
    "//ios/chrome/browser/location_bar/ui_bundled:constants",
    "//ios/chrome/browser/net/model",
    "//ios/chrome/browser/ntp/model",
    "//ios/chrome/browser/ntp/shared/metrics:home_metrics",
    "//ios/chrome/browser/orchestrator/ui_bundled:ui_bundled",
    "//ios/chrome/browser/prerender/model",
    "//ios/chrome/browser/search_engines/model",
    "//ios/chrome/browser/search_engines/model:search_engines_util",
    "//ios/chrome/browser/sessions/model",
    "//ios/chrome/browser/shared/coordinator/chrome_coordinator",
    "//ios/chrome/browser/shared/coordinator/layout_guide",
    "//ios/chrome/browser/shared/coordinator/scene:scene_state_header",
    "//ios/chrome/browser/shared/model/browser",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/public/commands",
    "//ios/chrome/browser/shared/public/features",
    "//ios/chrome/browser/shared/public/features:system_flags",
    "//ios/chrome/browser/shared/ui/elements",
    "//ios/chrome/browser/shared/ui/symbols",
    "//ios/chrome/browser/shared/ui/util",
    "//ios/chrome/browser/shared/ui/util:omnibox_util",
    "//ios/chrome/browser/shared/ui/util:util_swift",
    "//ios/chrome/browser/ui/fullscreen",
    "//ios/chrome/browser/ui/lens:lens_entrypoint",
    "//ios/chrome/browser/ui/main:default_browser_scene_agent",
    "//ios/chrome/browser/ui/omnibox/popup",
    "//ios/chrome/browser/ui/omnibox/popup:popup_ui_protocols",
    "//ios/chrome/browser/ui/toolbar/public:constants",
    "//ios/chrome/browser/url_loading/model",
    "//ios/chrome/common",
    "//ios/chrome/common/ui/colors",
    "//ios/chrome/common/ui/favicon:favicon",
    "//ios/chrome/common/ui/favicon:favicon_constants",
    "//ios/chrome/common/ui/util",
    "//ios/chrome/common/ui/util:dynamic_type_util",
    "//ios/components/security_interstitials/https_only_mode",
    "//ios/public/provider/chrome/browser/branded_images:branded_images_api",
    "//ios/public/provider/chrome/browser/lens:lens_api",
    "//ios/web/common:uikit",
    "//ios/web/public",
    "//net",
    "//skia",
    "//ui/base",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//url",
  ]
  public_deps = [
    ":omnibox_icon_type_constants",
    "//components/omnibox/browser",
  ]
  frameworks = [
    "CoreText.framework",
    "MobileCoreServices.framework",
    "QuartzCore.framework",
    "UIKit.framework",
    "UniformTypeIdentifiers.framework",
  ]
}

source_set("eg_app_support+eg2") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [
    "omnibox_app_interface.h",
    "omnibox_app_interface.mm",
    "test_fake_suggestions_service.cc",
    "test_fake_suggestions_service.h",
  ]
  deps = [
    ":omnibox_internal",
    ":resources_fake_suggestions_tests",
    "//base",
    "//components/google/core/common",
    "//components/history/core/browser",
    "//components/omnibox/browser",
    "//components/search_engines",
    "//components/variations:variations",
    "//ios/chrome/browser/autocomplete/model",
    "//ios/chrome/browser/history/model",
    "//ios/chrome/browser/search_engines/model",
    "//ios/chrome/browser/search_engines/model:template_url_service_factory",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/browser/ui/omnibox/popup:popup_ui",
    "//ios/chrome/test/app:test_support",
    "//ios/testing:nserror_support",
    "//ios/testing/earl_grey:eg_app_support+eg2",
    "//ios/third_party/earl_grey2:app_framework+link",
    "//ios/web/public",
    "//ios/web/public/navigation",
    "//net:test_support",
    "//services/network:test_support",
    "//ui/base",
    "//ui/base:test_support",
  ]
}
source_set("eg_test_support+eg2") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [
    "omnibox_app_interface.h",
    "omnibox_app_interface_stub.mm",
    "omnibox_earl_grey.h",
    "omnibox_earl_grey.mm",
    "omnibox_matchers.h",
    "omnibox_matchers.mm",
    "omnibox_test_util.h",
    "omnibox_test_util.mm",
  ]
  deps = [
    "//base/test:test_support",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/ui/omnibox/popup:popup_accessibility_identifier_constants",
    "//ios/chrome/test/earl_grey:eg_test_support+eg2",
    "//ios/testing/earl_grey:eg_test_support+eg2",
    "//ios/testing/earl_grey:launch_configuration",
    "//net:test_support",
    "//ui/base",
  ]
}

source_set("eg2_tests") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true
  sources = [
    "omnibox_edit_egtest.mm",
    "omnibox_egtest.mm",
  ]
  deps = [
    ":eg_test_support+eg2",
    ":features",
    "//components/feature_engagement/public",
    "//components/omnibox/common",
    "//components/strings:components_strings_grit",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/iph_for_new_chrome_user/model:features",
    "//ios/chrome/browser/shared/model/prefs:pref_names",
    "//ios/chrome/browser/shared/public/features",
    "//ios/chrome/browser/ui/content_suggestions:content_suggestions_constant",
    "//ios/chrome/browser/ui/omnibox/popup:popup_accessibility_identifier_constants",
    "//ios/chrome/browser/ui/toolbar/public:constants",
    "//ios/chrome/test/earl_grey:eg_test_support+eg2",
    "//ios/chrome/test/earl_grey:switches",
    "//ios/testing/earl_grey:eg_test_support+eg2",
    "//ios/web/public/test:element_selector",
    "//net:test_support",
    "//ui/base",
  ]
  frameworks = [ "UIKit.framework" ]
}

source_set("test_support") {
  testonly = true
  sources = [
    "test_web_location_bar.cc",
    "test_web_location_bar.h",
  ]
  deps = [
    ":omnibox",
    "//base",
    "//components/omnibox/browser:location_bar",
    "//ios/web/public",
    "//url",
  ]
  frameworks = [ "UIKit.framework" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "chrome_omnibox_client_ios_unittest.mm",
    "fake_suggestions_database_unittest.cc",
    "omnibox_text_field_ios_unittest.mm",
    "omnibox_view_ios_unittest.mm",
    "zero_suggest_prefetch_helper_unittest.mm",
  ]
  deps = [
    ":features",
    ":omnibox",
    ":omnibox_internal",
    ":resources_unit_tests",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//components/bookmarks/browser",
    "//components/feature_engagement/public",
    "//components/feature_engagement/test:test_support",
    "//components/omnibox/browser:test_support",
    "//components/search_engines",
    "//components/search_engines:test_support",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/autocomplete/model",
    "//ios/chrome/browser/main/model",
    "//ios/chrome/browser/shared/model/browser/test:test_support",
    "//ios/chrome/browser/shared/model/paths",
    "//ios/chrome/browser/shared/model/profile/test",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/chrome/browser/shared/model/web_state_list/test:test_support",
    "//ios/chrome/browser/shared/ui/util",
    "//ios/chrome/test:block_cleanup_test",
    "//ios/testing:nserror_support",
    "//ios/web/common:uikit",
    "//ios/web/public/test/fakes",
    "//testing/gtest",
    "//third_party/ocmock",
    "//ui/base",
  ]
}

bundle_data("resources_unit_tests") {
  visibility = [ ":unit_tests" ]
  testonly = true
  sources = [ "//ios/chrome/test/data/omnibox/selected_ranges.txt" ]
  outputs = [ "{{bundle_resources_dir}}/" +
              "ios/chrome/test/data/omnibox/{{source_file_part}}" ]
}

bundle_data("resources_fake_suggestions_tests") {
  visibility = [ ":eg_app_support+eg2" ]
  testonly = true
  sources = [
    "//ios/chrome/test/data/omnibox/fake_suggestion_actions.json",
    "//ios/chrome/test/data/omnibox/fake_suggestions_pedal.json",
    "//ios/chrome/test/data/omnibox/fake_suggestions_sample.json",
  ]
  outputs = [ "{{bundle_resources_dir}}/" +
              "{{source_root_relative_dir}}/{{source_file_part}}" ]
}

source_set("features") {
  sources = [
    "omnibox_ui_features.cc",
    "omnibox_ui_features.h",
  ]
  public_deps = [ "//base" ]
  deps = [
    "//components/omnibox/common",
    "//ios/chrome/browser/shared/public/features",
    "//ui/base",
  ]
}