chromium/ios/chrome/browser/web/model/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("//base/allocator/allocator.gni")
import("//ios/web/public/js_messaging/optimize_js.gni")
import("//rlz/buildflags/buildflags.gni")

source_set("model") {
  sources = [
    "blocked_popup_tab_helper.h",
    "blocked_popup_tab_helper.mm",
    "certificate_policy_app_agent.h",
    "certificate_policy_app_agent.mm",
    "error_page_util.h",
    "error_page_util.mm",
    "invalid_url_tab_helper.h",
    "invalid_url_tab_helper.mm",
    "load_timing_tab_helper.h",
    "load_timing_tab_helper.mm",
    "repost_form_tab_helper.h",
    "repost_form_tab_helper.mm",
    "sad_tab_tab_helper.h",
    "sad_tab_tab_helper.mm",
    "web_navigation_browser_agent.h",
    "web_navigation_browser_agent.mm",
    "web_navigation_ntp_delegate.h",
    "web_navigation_util.h",
    "web_navigation_util.mm",
  ]
  deps = [
    ":feature_flags",
    ":page_placeholder",
    ":tab_helper_delegates",
    "//base",
    "//components/content_settings/core/browser",
    "//components/content_settings/core/browser:cookie_settings",
    "//components/error_page/common",
    "//components/feature_engagement/public",
    "//components/pref_registry",
    "//components/resources:components_resources_grit",
    "//components/resources:dev_ui_components_resources_grit",
    "//components/search_engines",
    "//components/strings",
    "//components/ukm/ios:ukm_url_recorder",
    "//components/variations/net",
    "//ios/chrome/app/application_delegate:observing_app_state_agent",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/content_settings/model",
    "//ios/chrome/browser/feature_engagement/model",
    "//ios/chrome/browser/infobars/model",
    "//ios/chrome/browser/infobars/model:public",
    "//ios/chrome/browser/lens/model",
    "//ios/chrome/browser/ntp/model",
    "//ios/chrome/browser/shared/model/application_context",
    "//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/model/utils",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/chrome/browser/shared/public/commands",
    "//ios/chrome/browser/shared/ui/elements",
    "//ios/chrome/browser/shared/ui/util",
    "//ios/chrome/browser/ui/fullscreen",
    "//ios/chrome/common/ui/util",
    "//ios/components/ui_util",
    "//ios/components/webui:url_constants",
    "//ios/net",
    "//ios/web/common",
    "//ios/web/common:user_agent",
    "//ios/web/public/js_messaging",
    "//ios/web/public/security",
    "//ios/web/public/session",
    "//services/metrics/public/cpp:ukm_builders",
    "//ui/base",
    "//url",
  ]
  public_deps = [
    "//components/infobars/core",
    "//ios/web/public",
  ]
}

source_set("delegate") {
  sources = [
    "web_state_delegate_browser_agent.h",
    "web_state_delegate_browser_agent.mm",
    "web_state_update_browser_agent.h",
    "web_state_update_browser_agent.mm",
  ]
  deps = [
    ":model",
    ":tab_helper_delegates",
    "//base",
    "//components/content_settings/core/browser",
    "//components/content_settings/core/browser:cookie_settings",
    "//ios/chrome/browser/content_settings/model",
    "//ios/chrome/browser/context_menu/ui_bundled:coordinator",
    "//ios/chrome/browser/dialogs/ui_bundled:dialogs_internal",
    "//ios/chrome/browser/overlays/model",
    "//ios/chrome/browser/overlays/model/public/web_content_area",
    "//ios/chrome/browser/permissions/model:tab_helper",
    "//ios/chrome/browser/shared/model/browser",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/chrome/browser/snapshots/model",
    "//ios/chrome/browser/supervised_user/model:capabilities",
    "//ios/chrome/browser/tab_insertion/model",
    "//ios/chrome/browser/url_loading/model",
    "//ios/chrome/browser/url_loading/model:url_loading_params_header",
    "//ios/components/security_interstitials",
    "//ios/web/public",
    "//url",
  ]

  frameworks = [
    "UIKit.framework",
    "Foundation.framework",
  ]
}

source_set("page_placeholder") {
  sources = [
    "page_placeholder_browser_agent.h",
    "page_placeholder_browser_agent.mm",
    "page_placeholder_tab_helper.h",
    "page_placeholder_tab_helper.mm",
  ]
  deps = [
    "//base",
    "//ios/chrome/browser/sessions/model:restoration_observer",
    "//ios/chrome/browser/sessions/model:session_restoration_service",
    "//ios/chrome/browser/sessions/model:session_restoration_service_factory",
    "//ios/chrome/browser/shared/model/browser",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/chrome/browser/shared/ui/elements",
    "//ios/chrome/browser/shared/ui/util",
    "//ios/chrome/browser/snapshots/model",
    "//ios/chrome/common/ui/util",
    "//ios/net",
  ]
  public_deps = [ "//ios/web/public" ]
}

source_set("tab_helper_delegates") {
  sources = [
    "repost_form_tab_helper_delegate.h",
    "sad_tab_tab_helper_delegate.h",
    "web_state_container_view_provider.h",
  ]
  deps = [ "//ios/web/public" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "certificate_policy_app_agent_unittest.mm",
    "error_page_util_unittest.mm",
    "invalid_url_tab_helper_unittest.mm",
    "load_timing_tab_helper_unittest.mm",
    "page_placeholder_tab_helper_unittest.mm",
    "repost_form_tab_helper_unittest.mm",
    "sad_tab_tab_helper_unittest.mm",
    "web_navigation_browser_agent_unittest.mm",
    "web_navigation_util_unittest.mm",
    "web_state_delegate_browser_agent_unittest.mm",
  ]
  deps = [
    ":delegate",
    ":feature_flags",
    ":model",
    ":page_placeholder",
    ":tab_helper_delegates",
    "//base",
    "//base/test:test_support",
    "//components/search_engines",
    "//components/strings",
    "//components/sync_preferences:sync_preferences",
    "//components/sync_preferences:test_support",
    "//ios/chrome/app:app_internal",
    "//ios/chrome/app/application_delegate:application_delegate_internal",
    "//ios/chrome/browser/lens/model",
    "//ios/chrome/browser/main/model",
    "//ios/chrome/browser/ntp/model",
    "//ios/chrome/browser/overlays/model",
    "//ios/chrome/browser/overlays/model/public/web_content_area",
    "//ios/chrome/browser/shared/model/browser/test:test_support",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/prefs:browser_prefs",
    "//ios/chrome/browser/shared/model/profile",
    "//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/ui/util",
    "//ios/chrome/browser/snapshots/model",
    "//ios/chrome/browser/tab_insertion/model",
    "//ios/chrome/browser/web/model",
    "//ios/chrome/test:test_support",
    "//ios/net",
    "//ios/net:test_support",
    "//ios/web",
    "//ios/web/public/security",
    "//ios/web/public/session",
    "//ios/web/public/test",
    "//ios/web/public/test/fakes",
    "//ios/web/public/test/http_server",
    "//net:test_support",
    "//services/network:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/ocmock",
    "//ui/base",
    "//url:url",
  ]
}

source_set("web_internal") {
  sources = [
    "browser_about_rewriter.cc",
    "browser_about_rewriter.h",
    "chrome_main_parts.h",
    "chrome_main_parts.mm",
    "chrome_web_client.h",
    "chrome_web_client.mm",
    "ios_thread_profiler.cc",
    "ios_thread_profiler.h",
  ]
  public_deps = [
    "//base",
    "//components/memory_system",
    "//ios/chrome/browser/flags:client_side",
    "//ios/web/public/init",
  ]
  deps = [
    ":feature_flags",
    ":model",
    "//base/allocator:buildflags",
    "//build:blink_buildflags",
    "//components/autofill/core/common:features",
    "//components/autofill/ios/browser",
    "//components/autofill/ios/form_util:form_handler_feature",
    "//components/content_settings/core/browser",
    "//components/content_settings/core/browser:cookie_settings",
    "//components/crash/core/common:crash_key",
    "//components/crash/core/common:reporter_running_ios",
    "//components/dom_distiller/core",
    "//components/flags_ui",
    "//components/google/core/common",
    "//components/keyed_service/ios",
    "//components/language/core/browser",
    "//components/language/ios/browser",
    "//components/metrics",
    "//components/metrics:call_stack_profile_encoding",
    "//components/metrics:child_call_stack_profile_builder",
    "//components/metrics/public/mojom:call_stack_mojo_bindings",
    "//components/metrics_services_manager",
    "//components/open_from_clipboard",
    "//components/password_manager/core/common:features",
    "//components/password_manager/ios:password_manager_feature_header",
    "//components/payments/core",
    "//components/prefs",
    "//components/previous_session_info",
    "//components/resources",
    "//components/signin/public/identity_manager",
    "//components/strings",
    "//components/supervised_user/core/browser",
    "//components/supervised_user/core/common:buildflags",
    "//components/translate/core/browser",
    "//components/translate/ios/browser",
    "//components/url_formatter",
    "//components/variations",
    "//components/variations/field_trial_config",
    "//components/variations/service",
    "//components/version_info",
    "//ios/chrome/app/resources:ios_resources",
    "//ios/chrome/browser/application_context/model",
    "//ios/chrome/browser/autofill/model/bottom_sheet",
    "//ios/chrome/browser/browser_state/model",
    "//ios/chrome/browser/content_settings/model",
    "//ios/chrome/browser/crash_report/model",
    "//ios/chrome/browser/first_run/model",
    "//ios/chrome/browser/flags",
    "//ios/chrome/browser/flags:system_flags",
    "//ios/chrome/browser/follow/model:javascript_feature",
    "//ios/chrome/browser/https_upgrades/model",
    "//ios/chrome/browser/link_to_text/model",
    "//ios/chrome/browser/metrics/model:accessor",
    "//ios/chrome/browser/metrics/model:expired_histograms_array",
    "//ios/chrome/browser/ntp/model",
    "//ios/chrome/browser/open_from_clipboard/model",
    "//ios/chrome/browser/optimization_guide/model",
    "//ios/chrome/browser/passwords/model",
    "//ios/chrome/browser/permissions/model:features",
    "//ios/chrome/browser/permissions/model:geolocation",
    "//ios/chrome/browser/permissions/model:media",
    "//ios/chrome/browser/policy/model",
    "//ios/chrome/browser/prerender/model",
    "//ios/chrome/browser/promos_manager/model",
    "//ios/chrome/browser/reading_list/model",
    "//ios/chrome/browser/safe_browsing/model",
    "//ios/chrome/browser/search_engines/model",
    "//ios/chrome/browser/segmentation_platform/model:ukm_client",
    "//ios/chrome/browser/shared/model/application_context",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/paths",
    "//ios/chrome/browser/shared/model/prefs:pref_names",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/browser/shared/model/url",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/public/features",
    "//ios/chrome/browser/shared/ui/elements",
    "//ios/chrome/browser/shared/ui/util",
    "//ios/chrome/browser/signin/model:signin_util",
    "//ios/chrome/browser/ssl/model",
    "//ios/chrome/browser/supervised_user/model",
    "//ios/chrome/browser/translate/model",
    "//ios/chrome/browser/ui/infobars/coordinators",
    "//ios/chrome/browser/web/model/choose_file",
    "//ios/chrome/browser/web/model/font_size",
    "//ios/chrome/browser/web/model/image_fetch",
    "//ios/chrome/browser/web/model/java_script_console",
    "//ios/chrome/browser/web/model/print",
    "//ios/chrome/browser/web/model/web_performance_metrics",
    "//ios/chrome/browser/web_selection/model",
    "//ios/chrome/common",
    "//ios/components/security_interstitials",
    "//ios/components/security_interstitials/https_only_mode",
    "//ios/components/security_interstitials/https_only_mode:feature",
    "//ios/components/security_interstitials/lookalikes",
    "//ios/components/security_interstitials/safe_browsing",
    "//ios/components/webui:url_constants",
    "//ios/net",
    "//ios/public/provider/chrome/browser/url_rewriters:url_rewriters_api",
    "//ios/web/common",
    "//ios/web/common:user_agent",
    "//ios/web/public",
    "//ios/web/public/find_in_page",
    "//ios/web/public/js_messaging",
    "//net",
    "//rlz/buildflags",
    "//services/metrics/public/cpp:metrics_cpp",
    "//ui/base",
    "//ui/display",
    "//ui/gfx",
    "//url",
  ]
  frameworks = [
    "UIKit.framework",
    "Foundation.framework",
  ]

  if (enable_rlz) {
    deps += [ "//ios/chrome/browser/rlz" ]
  }
}

source_set("unit_tests_internal") {
  testonly = true
  sources = [
    "blocked_popup_tab_helper_unittest.mm",
    "browser_about_rewriter_unittest.cc",
    "chrome_web_client_unittest.mm",
  ]
  deps = [
    ":feature_flags",
    ":web_internal",
    "//base",
    "//base/test:test_support",
    "//components/captive_portal/core",
    "//components/content_settings/core/browser",
    "//components/content_settings/core/browser:cookie_settings",
    "//components/infobars/core",
    "//components/lookalikes/core",
    "//components/payments/core",
    "//components/safe_browsing/ios/browser:allow_list",
    "//components/security_interstitials/core:unsafe_resource",
    "//components/strings",
    "//components/version_info",
    "//ios/chrome/browser/content_settings/model:model",
    "//ios/chrome/browser/find_in_page/model",
    "//ios/chrome/browser/infobars/model",
    "//ios/chrome/browser/infobars/model:public",
    "//ios/chrome/browser/passwords/model",
    "//ios/chrome/browser/reading_list/model",
    "//ios/chrome/browser/safe_browsing/model",
    "//ios/chrome/browser/shared/model/profile/test",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/ssl/model",
    "//ios/chrome/browser/web/model",
    "//ios/chrome/test/fakes",
    "//ios/components/security_interstitials",
    "//ios/components/security_interstitials/https_only_mode",
    "//ios/components/security_interstitials/lookalikes",
    "//ios/components/security_interstitials/safe_browsing",
    "//ios/net",
    "//ios/web/common:features",
    "//ios/web/common:web_view_creation_util",
    "//ios/web/public/test",
    "//ios/web/public/test/fakes",
    "//net",
    "//net:test_support",
    "//services/network:test_support",
    "//services/network/public/mojom",
    "//testing/gtest",
    "//third_party/ocmock",
    "//ui/base",
    "//url",
  ]
}

source_set("constants") {
  sources = [
    "lookalike_url_constants.h",
    "lookalike_url_constants.mm",
  ]
}

source_set("eg_test_support+eg2") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true

  sources = [
    "lookalike_url_app_interface.h",
    "lookalike_url_app_interface_stub.mm",
    "progress_indicator_app_interface.h",
    "progress_indicator_app_interface_stub.mm",
  ]

  deps = [
    "//ios/chrome/test/earl_grey:eg_test_support+eg2",
    "//ios/testing/earl_grey:eg_test_support+eg2",
  ]
}

source_set("eg_app_support+eg2") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true

  sources = [
    "lookalike_url_app_interface.h",
    "lookalike_url_app_interface.mm",
    "progress_indicator_app_interface.h",
    "progress_indicator_app_interface.mm",
  ]

  deps = [
    ":constants",
    "//base",
    "//components/content_settings/core/browser",
    "//components/content_settings/core/browser:cookie_settings",
    "//components/lookalikes/core",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/test/app:test_support",
    "//ios/components/security_interstitials/lookalikes",
    "//ios/testing/earl_grey:eg_app_support+eg2",
    "//ios/third_party/earl_grey2:app_framework+link",
    "//ios/third_party/material_components_ios",
    "//ios/web/public",
    "//net",
  ]
}

source_set("eg2_tests") {
  configs += [ "//build/config/ios:xctest_config" ]
  testonly = true

  sources = [
    "browsing_egtest.mm",
    "browsing_prevent_default_egtest.mm",
    "cache_egtest.mm",
    "child_window_open_by_dom_egtest.mm",
    "content_mode_egtest.mm",
    "error_page_egtest.mm",
    "forms_egtest.mm",
    "http_auth_egtest.mm",
    "js_print_egtest.mm",
    "lookalike_url_egtest.mm",
    "navigation_egtest.mm",
    "progress_indicator_egtest.mm",
    "push_and_replace_state_navigation_egtest.mm",
    "restore_egtest.mm",
    "ssl_egtest.mm",
    "stop_loading_egtest.mm",
    "tab_order_egtest.mm",
    "visible_url_egtest.mm",
    "web_share_egtest.mm",
    "window_open_by_dom_egtest.mm",
  ]

  deps = [
    ":constants",
    ":eg_test_support+eg2",
    "//components/content_settings/core/common",
    "//components/omnibox/common",
    "//components/security_interstitials/core",
    "//components/strings",
    "//components/url_formatter",
    "//components/version_info:version_info",
    "//ios/chrome/app/strings",
    "//ios/chrome/browser/metrics/model:eg_test_support+eg2",
    "//ios/chrome/browser/shared/model/prefs:pref_names",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/public/features",
    "//ios/chrome/browser/start_surface/ui_bundled:feature_flags",
    "//ios/chrome/browser/ui/infobars/banners:public",
    "//ios/chrome/browser/ui/popup_menu:constants",
    "//ios/chrome/test:eg_test_support+eg2",
    "//ios/chrome/test/earl_grey:eg_test_support+eg2",
    "//ios/net:test_support",
    "//ios/testing:embedded_test_server_support",
    "//ios/testing/earl_grey:eg_test_support+eg2",
    "//ios/web/common:features",
    "//ios/web/public/test:element_selector",
    "//ios/web/public/test/http_server",
    "//net:test_support",
    "//ui/base",
    "//url",
  ]

  frameworks = [ "UIKit.framework" ]
}

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