chromium/ios/chrome/browser/sessions/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.

source_set("model") {
  sources = [
    "ios_chrome_session_tab_helper.h",
    "ios_chrome_session_tab_helper.mm",
    "ios_chrome_tab_restore_service_client.h",
    "ios_chrome_tab_restore_service_client.mm",
    "ios_chrome_tab_restore_service_factory.cc",
    "ios_chrome_tab_restore_service_factory.h",
    "live_tab_context_browser_agent.h",
    "live_tab_context_browser_agent.mm",
  ]
  public_deps = [ "//components/sessions" ]
  deps = [
    ":serialisation",
    ":session_util",
    "//base",
    "//components/keyed_service/ios",
    "//components/tab_groups",
    "//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/web_state_list",
    "//ios/chrome/browser/tabs/model",
  ]
  frameworks = [ "UIKit.framework" ]
}

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

source_set("restoration_observer") {
  sources = [ "session_restoration_observer.h" ]
  public_deps = [ "//base" ]
}

source_set("restoration_agent") {
  visibility = [ ":*" ]
  sources = [
    "session_restoration_browser_agent.h",
    "session_restoration_browser_agent.mm",
  ]
  deps = [
    ":restoration_observer",
    ":serialisation",
    ":session_constants",
    ":session_service",
    ":session_state",
    "//components/previous_session_info",
    "//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/web/public",
    "//ios/web/public:web_state_observer",
    "//ios/web/public/navigation",
    "//ios/web/public/session",
  ]
  public_deps = [ "//base" ]
}

source_set("session_service") {
  visibility = [ ":*" ]
  sources = [
    "session_service_ios.h",
    "session_service_ios.mm",
    "session_window_ios_factory.h",
    "session_window_ios_factory.mm",
  ]
  deps = [
    ":serialisation",
    ":session_constants",
    ":session_internal_util",
    "//base",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/web/public",
    "//ios/web/public/session",
  ]
}

source_set("serialisation") {
  visibility = [ ":*" ]
  sources = [
    "NSCoder+Compatibility.h",
    "NSCoder+Compatibility.mm",
    "session_ios.h",
    "session_ios.mm",
    "session_tab_group.h",
    "session_tab_group.mm",
    "session_window_ios.h",
    "session_window_ios.mm",
    "tab_group_util.h",
    "tab_group_util.mm",
    "web_state_list_serialization.h",
    "web_state_list_serialization.mm",
  ]
  deps = [
    ":features",
    ":session_constants",
    "//base",
    "//components/sessions:session_id",
    "//components/tab_groups",
    "//ios/chrome/browser/sessions/model/proto",
    "//ios/chrome/browser/shared/model/url:constants",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/web/public",
    "//ios/web/public/navigation",
    "//ios/web/public/session",
  ]
}

source_set("session_util") {
  sources = [
    "session_util.h",
    "session_util.mm",
  ]
  deps = [
    "//base",
    "//components/sessions",
    "//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/web/public",
    "//ios/web/public/navigation",
  ]
}

source_set("session_saving") {
  sources = [
    "session_saving_scene_agent.h",
    "session_saving_scene_agent.mm",
  ]
  deps = [
    ":session_restoration_service",
    ":session_restoration_service_factory",
    "//ios/chrome/browser/shared/coordinator/scene:observing_scene_agent",
    "//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/web_state_list/model/web_usage_enabler",
  ]
}

source_set("session_io") {
  visibility = [
    ":session_restoration_service_impl",
    ":unit_tests",
  ]
  sources = [
    "session_io_request.h",
    "session_io_request.mm",
    "session_loading.h",
    "session_loading.mm",
  ]
  deps = [
    ":session_constants",
    ":session_internal_util",
    "//base",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/web/public",
    "//third_party/protobuf:protobuf_lite",
  ]
  public_deps = [
    "//ios/chrome/browser/sessions/model/proto",
    "//ios/web/public/session/proto",
  ]
}

source_set("session_restoration_service") {
  sources = [
    "session_restoration_service.h",
    "session_restoration_service_tmpl.h",
  ]
  deps = [
    "//base",
    "//components/keyed_service/core",
    "//ios/web/public",
  ]
  public_deps = [ "//ios/web/public/session/proto" ]
}

source_set("session_restoration_service_impl") {
  visibility = [
    ":session_restoration_service_factory",
    ":unit_tests",
  ]
  sources = [
    "session_restoration_scroll_observer.h",
    "session_restoration_scroll_observer.mm",
    "session_restoration_service_impl.h",
    "session_restoration_service_impl.mm",
    "session_restoration_web_state_list_observer.h",
    "session_restoration_web_state_list_observer.mm",
    "session_restoration_web_state_observer.h",
    "session_restoration_web_state_observer.mm",
  ]
  deps = [
    ":restoration_observer",
    ":serialisation",
    ":session_constants",
    ":session_internal_util",
    ":session_io",
    ":session_restoration_service",
    "//base",
    "//ios/chrome/browser/sessions/model/proto",
    "//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/web/public",
    "//ios/web/public:web_state_observer",
    "//ios/web/public/js_messaging",
    "//ios/web/public/navigation",
    "//ios/web/public/session/proto",
    "//ios/web/public/ui",
  ]
}

source_set("legacy_session_restoration_service") {
  visibility = [ ":*" ]
  sources = [
    "legacy_session_restoration_service.h",
    "legacy_session_restoration_service.mm",
  ]
  deps = [
    ":restoration_agent",
    ":restoration_observer",
    ":session_restoration_service",
    ":session_service",
    ":session_state",
    "//base",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/browser/shared/model/web_state_list",
    "//ios/web/public",
    "//ios/web/public/session",
    "//ios/web/public/session/proto",
  ]
}

source_set("session_restoration_service_factory") {
  sources = [
    "session_restoration_service_factory.h",
    "session_restoration_service_factory.mm",
  ]
  deps = [
    ":features",
    ":legacy_session_restoration_service",
    ":session_constants",
    ":session_migration",
    ":session_restoration_service_impl",
    ":session_service",
    ":session_state",
    "//base",
    "//components/keyed_service/ios",
    "//components/pref_registry",
    "//components/prefs",
    "//ios/chrome/browser/shared/model/browser",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/chrome/browser/shared/public/features",
  ]
}

source_set("session_constants") {
  visibility = [ ":*" ]
  sources = [
    "session_constants.h",
    "session_constants.mm",
  ]
  deps = [ "//base" ]
}

source_set("session_migration") {
  visibility = [ ":*" ]
  sources = [
    "session_migration.h",
    "session_migration.mm",
  ]
  deps = [
    ":serialisation",
    ":session_constants",
    ":session_internal_util",
    "//base",
    "//ios/chrome/browser/sessions/model/proto",
    "//ios/web/public",
    "//ios/web/public/session",
    "//ios/web/public/session/proto",
  ]
}

source_set("session_internal_util") {
  visibility = [ ":*" ]
  sources = [
    "session_internal_util.h",
    "session_internal_util.mm",
  ]
  deps = [
    ":serialisation",
    "//base",
    "//third_party/protobuf:protobuf_lite",
  ]
}

source_set("test_support") {
  testonly = true
  sources = [
    "proto_util.cc",
    "proto_util.h",
    "test_session_restoration_observer.h",
    "test_session_restoration_observer.mm",
    "test_session_restoration_service.h",
    "test_session_restoration_service.mm",
    "test_session_service.h",
    "test_session_service.mm",
  ]
  deps = [
    ":restoration_observer",
    ":session_restoration_service",
    ":session_service",
    "//base",
    "//components/keyed_service/ios",
    "//ios/chrome/browser/sessions/model/proto",
    "//ios/chrome/browser/shared/model/browser",
    "//ios/chrome/browser/shared/model/browser_state",
    "//ios/chrome/browser/shared/model/profile",
    "//ios/web/public",
    "//ios/web/public/session/proto",
    "//third_party/protobuf:protobuf_lite",
  ]
}

source_set("fake") {
  testonly = true
  sources = [
    "fake_tab_restore_service.h",
    "fake_tab_restore_service.mm",
  ]
  deps = [
    "//base",
    "//components/sessions",
  ]
}

source_set("session_state") {
  sources = [
    "web_session_state_cache.h",
    "web_session_state_cache.mm",
    "web_session_state_cache_factory.h",
    "web_session_state_cache_factory.mm",
    "web_session_state_cache_web_state_list_observer.h",
    "web_session_state_cache_web_state_list_observer.mm",
    "web_session_state_tab_helper.h",
    "web_session_state_tab_helper.mm",
  ]

  deps = [
    ":session_constants",
    "//build:branding_buildflags",
    "//components/keyed_service/core",
    "//components/keyed_service/ios",
    "//components/strings",
    "//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/web_state_list",
    "//ios/web/navigation:wk_navigation_util",
    "//ios/web/public",
    "//ios/web/public/js_messaging",
    "//ios/web/public/session",
    "//ios/web/web_state:web_state_impl_header",
    "//ui/base",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "legacy_session_restoration_service_unittest.mm",
    "proto_util_unittest.cc",
    "session_internal_util_unittest.mm",
    "session_io_request_unittest.mm",
    "session_loading_unittest.mm",
    "session_migration_unittest.mm",
    "session_restoration_browser_agent_unittest.mm",
    "session_restoration_scroll_observer_unittest.mm",
    "session_restoration_service_factory_unittest.mm",
    "session_restoration_service_impl_unittest.mm",
    "session_restoration_web_state_list_observer_unittest.mm",
    "session_restoration_web_state_observer_unittest.mm",
    "session_service_ios_unittest.mm",
    "session_window_ios_unittest.mm",
    "tab_group_util_unittest.mm",
    "web_session_state_cache_unittest.mm",
    "web_session_state_tab_helper_unittest.mm",
    "web_state_list_serialization_unittest.mm",
  ]
  deps = [
    ":fake",
    ":features",
    ":legacy_session_restoration_service",
    ":model",
    ":resources_unit_tests",
    ":restoration_agent",
    ":restoration_observer",
    ":serialisation",
    ":session_constants",
    ":session_internal_util",
    ":session_io",
    ":session_migration",
    ":session_restoration_service",
    ":session_restoration_service_factory",
    ":session_restoration_service_impl",
    ":session_service",
    ":session_state",
    ":test_support",
    "//base",
    "//base/test:test_support",
    "//components/prefs",
    "//components/sessions:session_id",
    "//components/tab_groups",
    "//ios/chrome/browser/main/model",
    "//ios/chrome/browser/ntp/model",
    "//ios/chrome/browser/sessions/model/proto",
    "//ios/chrome/browser/shared/model/browser",
    "//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/signin/model",
    "//ios/chrome/browser/signin/model:test_support",
    "//ios/chrome/browser/web/model:web_internal",
    "//ios/chrome/test:test_support",
    "//ios/web/common:user_agent",
    "//ios/web/navigation:wk_navigation_util",
    "//ios/web/public/navigation",
    "//ios/web/public/session",
    "//ios/web/public/session/proto",
    "//ios/web/public/session/proto:proto_util",
    "//ios/web/public/test",
    "//ios/web/public/test/fakes",
    "//ios/web/public/thread",
    "//ios/web/public/ui",
    "//testing/gtest",
    "//third_party/ocmock",
    "//url:url",
  ]
  frameworks = [ "Foundation.framework" ]
}

bundle_data("resources_unit_tests") {
  visibility = [ ":unit_tests" ]
  testonly = true
  sources = [
    "//ios/chrome/test/data/sessions/corrupted.plist",
    "//ios/chrome/test/data/sessions/session_m57.plist",
    "//ios/chrome/test/data/sessions/session_m58.plist",
  ]
  outputs = [ "{{bundle_resources_dir}}/ios/chrome/test/data/sessions/{{source_file_part}}" ]
}