# 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("//ios/build/chrome_build.gni")
import("//ios/web/public/js_messaging/optimize_ts.gni")
import("//rlz/buildflags/buildflags.gni")
source_set("model") {
sources = [
"search_engine_choice_service_factory.h",
"search_engine_choice_service_factory.mm",
"search_engine_java_script_feature.h",
"search_engine_java_script_feature.mm",
"search_engine_observer_bridge.h",
"search_engine_observer_bridge.mm",
"search_engine_tab_helper.h",
"search_engine_tab_helper.mm",
"search_engine_tab_helper_factory.h",
"search_engine_tab_helper_factory.mm",
"template_url_fetcher_factory.cc",
"template_url_fetcher_factory.h",
"template_url_service_client_impl.cc",
"template_url_service_client_impl.h",
"template_url_service_factory.h",
"template_url_service_factory.mm",
"ui_thread_search_terms_data.h",
"ui_thread_search_terms_data.mm",
]
deps = [
":search_engine_js",
"//base",
"//components/country_codes",
"//components/favicon/ios",
"//components/google/core/common",
"//components/history/core/browser",
"//components/keyed_service/core",
"//components/keyed_service/ios",
"//components/omnibox/browser",
"//components/prefs",
"//components/search",
"//components/search_engines",
"//components/variations/service",
"//components/version_info",
"//ios/chrome/browser/google/model",
"//ios/chrome/browser/history/model",
"//ios/chrome/browser/shared/model/application_context",
"//ios/chrome/browser/shared/model/browser_state",
"//ios/chrome/browser/shared/model/profile",
"//ios/chrome/browser/shared/public/features:system_flags",
"//ios/chrome/browser/webdata_services/model",
"//ios/chrome/common",
"//ios/public/provider/chrome/browser/app_distribution:app_distribution_api",
"//ios/web/public",
"//ios/web/public/js_messaging",
"//net",
"//rlz/buildflags",
"//ui/base",
"//url",
]
if (enable_rlz) {
deps += [ "//components/rlz" ]
}
}
source_set("extension_search_engine_data_updater") {
sources = [
"extension_search_engine_data_updater.h",
"extension_search_engine_data_updater.mm",
]
deps = [
":search_engines_util",
"//base",
"//components/search_engines",
"//ios/chrome/browser/widget_kit/model:features",
"//ios/chrome/common/app_group",
]
if (ios_enable_widget_kit_extension) {
deps += [ "//ios/chrome/browser/widget_kit/model" ]
}
}
source_set("unit_tests") {
testonly = true
sources = [
"extension_search_engine_data_updater_unittest.mm",
"search_engine_js_unittest.mm",
"search_engine_tab_helper_unittest.mm",
"search_engines_util_unittest.cc",
]
deps = [
":extension_search_engine_data_updater",
":model",
":search_engines_util",
"//base:base",
"//base/test:test_support",
"//components/country_codes",
"//components/favicon/core",
"//components/favicon/ios",
"//components/search_engines",
"//components/search_engines:test_support",
"//ios/chrome/browser/favicon/model",
"//ios/chrome/browser/shared/model/browser_state",
"//ios/chrome/browser/shared/model/profile",
"//ios/chrome/browser/shared/model/profile/test",
"//ios/chrome/browser/web/model:web_internal",
"//ios/chrome/common/app_group",
"//ios/web",
"//ios/web/public/test",
"//ios/web/public/test/fakes",
"//net:test_support",
"//services/data_decoder/public/cpp:test_support",
"//testing/gtest",
]
}
source_set("template_url_service_factory") {
# TODO(crbug.com/40245854): This target was added to prevent dependency
# cycles for Lens navigation.
# Remove this target after fixing the Lens / Web dependency cycle.
sources = [ "template_url_service_factory.h" ]
deps = [
"//base",
"//components/keyed_service/ios",
"//ios/chrome/browser/shared/model/profile",
]
}
source_set("search_engines_util") {
sources = [
"search_engines_util.cc",
"search_engines_util.h",
]
deps = [
"//base",
"//components/country_codes",
"//components/prefs",
"//components/search_engines",
]
}
optimize_ts("search_engine_js") {
sources = [ "resources/search_engine.ts" ]
deps = [ "//ios/web/public/js_messaging:util_scripts" ]
}
source_set("eg_app_support+eg2") {
configs += [ "//build/config/ios:xctest_config" ]
testonly = true
sources = [
"search_engines_app_interface.h",
"search_engines_app_interface.mm",
]
deps = [
"//base",
"//base/test:test_support",
"//components/search_engines",
"//ios/chrome/browser/search_engines/model",
"//ios/chrome/test/app:test_support",
"//ios/testing/earl_grey:eg_app_support+eg2",
"//ios/third_party/earl_grey2:app_framework+link",
"//testing/gmock",
"//testing/gtest:gtest",
]
}
source_set("eg_test_support+eg2") {
configs += [ "//build/config/ios:xctest_config" ]
testonly = true
sources = [
"search_engines_app_interface.h",
"search_engines_app_interface_stub.mm",
]
deps = [ "//ios/testing/earl_grey:eg_test_support+eg2" ]
}