chromium/ios/web/navigation/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.

import("//build/buildflag_header.gni")
import("//ios/build/config.gni")
import("//ios/features.gni")
import("//ios/web/public/js_messaging/optimize_ts.gni")

buildflag_header("block_universal_links_buildflags") {
  header = "block_universal_links_buildflags.h"
  flags = [ "BLOCK_UNIVERSAL_LINKS_IN_OFF_THE_RECORD_MODE=$block_universal_links_in_off_the_record_mode" ]
}

source_set("navigation") {
  deps = [
    ":block_universal_links_buildflags",
    ":core",
    ":navigation_manager_util",
    "//base",
    "//components/security_interstitials/core:insecure_form_util",
    "//components/sessions:session_id",
    "//ios/components/security_interstitials/https_only_mode:feature",
    "//ios/net",
    "//ios/web:core",
    "//ios/web/common",
    "//ios/web/download",
    "//ios/web/js_messaging",
    "//ios/web/navigation:wk_navigation_util",
    "//ios/web/public",
    "//ios/web/public/download",
    "//ios/web/public/js_messaging",
    "//ios/web/public/security",
    "//ios/web/public/session",
    "//ios/web/public/session/proto",
    "//ios/web/security",
    "//ios/web/session",
    "//ios/web/web_state:user_interaction",
    "//ios/web/web_state:web_state_impl_header",
    "//ios/web/web_state/ui:web_controller_header",
    "//ios/web/web_state/ui:web_view_handler",
    "//ios/web/web_view:util",
    "//net",
    "//services/metrics/public/cpp:metrics_cpp",
    "//ui/base",
    "//url",
  ]

  sources = [
    "crw_js_navigation_handler.h",
    "crw_js_navigation_handler.mm",
    "crw_pending_navigation_info.h",
    "crw_pending_navigation_info.mm",
    "crw_web_view_navigation_observer.h",
    "crw_web_view_navigation_observer.mm",
    "crw_web_view_navigation_observer_delegate.h",
    "crw_wk_navigation_handler.h",
    "crw_wk_navigation_handler.mm",
    "crw_wk_navigation_states.h",
    "crw_wk_navigation_states.mm",
    "serializable_user_data_manager_impl.h",
    "serializable_user_data_manager_impl.mm",
    "url_schemes.mm",
    "web_kit_constants.cc",
    "web_kit_constants.h",
    "wk_back_forward_list_item_holder.h",
    "wk_back_forward_list_item_holder.mm",
    "wk_navigation_action_policy_util.h",
    "wk_navigation_action_policy_util.mm",
    "wk_navigation_action_util.h",
    "wk_navigation_action_util.mm",
  ]
}

source_set("core") {
  deps = [
    ":proto_util",
    "//base",
    "//components/url_formatter:url_formatter",
    "//ios/web/common:features",
    "//ios/web/common:user_agent",
    "//ios/web/navigation:wk_navigation_util",
    "//ios/web/public",
    "//ios/web/public/security",
    "//ios/web/public/session/proto",
    "//ios/web/public/session/proto:proto_util",
    "//ios/web/web_state/ui:crw_web_view_navigation_proxy",
    "//ui/base",
  ]

  sources = [
    "crw_navigation_item_holder.h",
    "crw_navigation_item_holder.mm",
    "navigation_context_impl.h",
    "navigation_context_impl.mm",
    "navigation_initiation_type.h",
    "navigation_item_impl.h",
    "navigation_item_impl.mm",
    "navigation_manager_delegate.h",
    "navigation_manager_impl.h",
    "navigation_manager_impl.mm",
    "navigation_util.mm",
    "referrer.cc",
    "synthesized_history_entry_data.h",
    "synthesized_history_entry_data.mm",
    "synthesized_session_restore.h",
    "synthesized_session_restore.mm",
    "time_smoother.cc",
    "time_smoother.h",
  ]
}

source_set("navigation_feature") {
  deps = [
    ":navigation_js",
    ":navigation_listeners_js",
    "//base",
    "//ios/web/public/js_messaging",
    "//ios/web/web_state:web_state_impl_header",
    "//ios/web/web_state/ui:web_controller_header",
  ]
  sources = [
    "navigation_java_script_feature.h",
    "navigation_java_script_feature.mm",
  ]
}

optimize_ts("navigation_js") {
  visibility = [ ":navigation_feature" ]

  sources = [ "resources/navigation.ts" ]

  deps = [
    "//ios/web/public/js_messaging:gcrweb",
    "//ios/web/public/js_messaging:util_scripts",
  ]
}

optimize_ts("navigation_listeners_js") {
  visibility = [ ":navigation_feature" ]

  sources = [ "resources/navigation_listeners.ts" ]

  deps = [
    "//ios/web/public/js_messaging:gcrweb",
    "//ios/web/public/js_messaging:util_scripts",
  ]
}

source_set("session_restore_feature") {
  deps = [
    "//base",
    "//ios/web/js_messaging",
    "//ios/web/js_messaging:scoped_wk_script_message_handler",
    "//ios/web/js_messaging:web_view_js_utils",
    "//ios/web/public",
    "//ios/web/public/js_messaging",
  ]
  sources = [
    "session_restore_java_script_feature.h",
    "session_restore_java_script_feature.mm",
  ]
}

source_set("wk_navigation_util") {
  deps = [
    "//base",
    "//ios/web/common",
    "//ios/web/public",
    "//url",
  ]

  sources = [
    "crw_error_page_helper.h",
    "crw_error_page_helper.mm",
    "nscoder_util.h",
    "nscoder_util.mm",
    "wk_navigation_util.h",
    "wk_navigation_util.mm",
  ]
}

source_set("navigation_manager_util") {
  deps = [
    "//base",
    "//ios/web/navigation:core",
    "//ios/web/public",
  ]

  sources = [
    "navigation_manager_util.h",
    "navigation_manager_util.mm",
  ]
}

source_set("proto_util") {
  public_deps = [ "//ios/web/public/session/proto" ]
  deps = [ "//base" ]

  sources = [
    "proto_util.h",
    "proto_util.mm",
  ]
}