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

import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//third_party/WebKit/public/public_features.gni")

if (is_component_build) {
  link_target_type = "source_set"
} else {
  link_target_type = "static_library"
}
target(link_target_type, "child") {
  # Targets external to content should always link to the public API.
  # Internal targets can link to this but only if they're child processes
  # (i.e. not content/browser or content/common) and only if they're inside the
  # content component (i.e. not content/test or content/shell).
  visibility = [
    ":*",
    "//content/gpu/*",
    "//content/ppapi_plugin/*",
    "//content/public/child:child_sources",
    "//content/renderer/*",
    "//content/utility/*",
    "//tools/ipc_fuzzer/*",
  ]
  if (is_android) {
    # See comment in content/app/BUILD.gn above content_app_deps.
    visibility += [ "//content/app:*" ]
  }

  sources = [
    "appcache/appcache_backend_proxy.cc",
    "appcache/appcache_backend_proxy.h",
    "appcache/appcache_dispatcher.cc",
    "appcache/appcache_dispatcher.h",
    "appcache/appcache_frontend_impl.cc",
    "appcache/appcache_frontend_impl.h",
    "appcache/web_application_cache_host_impl.cc",
    "appcache/web_application_cache_host_impl.h",
    "assert_matching_enums.cc",
    "background_sync/background_sync_provider.cc",
    "background_sync/background_sync_provider.h",
    "background_sync/background_sync_type_converters.cc",
    "background_sync/background_sync_type_converters.h",
    "blink_platform_impl.cc",
    "blink_platform_impl.h",
    "blob_storage/blob_consolidation.cc",
    "blob_storage/blob_consolidation.h",
    "blob_storage/blob_message_filter.cc",
    "blob_storage/blob_message_filter.h",
    "blob_storage/blob_transport_controller.cc",
    "blob_storage/blob_transport_controller.h",
    "blob_storage/webblobregistry_impl.cc",
    "blob_storage/webblobregistry_impl.h",
    "browser_font_resource_trusted.cc",
    "browser_font_resource_trusted.h",
    "child_gpu_memory_buffer_manager.cc",
    "child_gpu_memory_buffer_manager.h",
    "child_histogram_message_filter.cc",
    "child_histogram_message_filter.h",
    "child_message_filter.cc",
    "child_message_filter.h",
    "child_process.cc",
    "child_process.h",
    "child_resource_message_filter.cc",
    "child_resource_message_filter.h",
    "child_shared_bitmap_manager.cc",
    "child_shared_bitmap_manager.h",
    "child_thread_impl.cc",
    "child_thread_impl.h",
    "content_child_helpers.cc",
    "content_child_helpers.h",
    "database_util.cc",
    "database_util.h",
    "db_message_filter.cc",
    "db_message_filter.h",
    "dwrite_font_proxy/dwrite_font_proxy_init_win.cc",
    "dwrite_font_proxy/dwrite_font_proxy_init_win.h",
    "dwrite_font_proxy/dwrite_font_proxy_win.cc",
    "dwrite_font_proxy/dwrite_font_proxy_win.h",
    "dwrite_font_proxy/dwrite_localized_strings_win.cc",
    "dwrite_font_proxy/dwrite_localized_strings_win.h",
    "dwrite_font_proxy/font_fallback_win.cc",
    "dwrite_font_proxy/font_fallback_win.h",
    "file_info_util.cc",
    "file_info_util.h",
    "fileapi/file_system_dispatcher.cc",
    "fileapi/file_system_dispatcher.h",
    "fileapi/webfilesystem_impl.cc",
    "fileapi/webfilesystem_impl.h",
    "fileapi/webfilewriter_base.cc",
    "fileapi/webfilewriter_base.h",
    "fileapi/webfilewriter_impl.cc",
    "fileapi/webfilewriter_impl.h",
    "font_warmup_win.cc",
    "font_warmup_win.h",
    "ftp_directory_listing_response_delegate.cc",
    "ftp_directory_listing_response_delegate.h",
    "image_decoder.cc",
    "image_decoder.h",
    "indexed_db/indexed_db_callbacks_impl.cc",
    "indexed_db/indexed_db_callbacks_impl.h",
    "indexed_db/indexed_db_database_callbacks_impl.cc",
    "indexed_db/indexed_db_database_callbacks_impl.h",
    "indexed_db/indexed_db_dispatcher.cc",
    "indexed_db/indexed_db_dispatcher.h",
    "indexed_db/indexed_db_key_builders.cc",
    "indexed_db/indexed_db_key_builders.h",
    "indexed_db/indexed_db_message_filter.cc",
    "indexed_db/indexed_db_message_filter.h",
    "indexed_db/webidbcursor_impl.cc",
    "indexed_db/webidbcursor_impl.h",
    "indexed_db/webidbdatabase_impl.cc",
    "indexed_db/webidbdatabase_impl.h",
    "indexed_db/webidbfactory_impl.cc",
    "indexed_db/webidbfactory_impl.h",
    "memory/child_memory_coordinator_impl.cc",
    "memory/child_memory_coordinator_impl.h",
    "memory/child_memory_coordinator_impl_android.cc",
    "memory/child_memory_coordinator_impl_android.h",
    "memory/child_memory_message_filter.cc",
    "memory/child_memory_message_filter.h",
    "mojo/type_converters.h",
    "notifications/notification_data_conversions.cc",
    "notifications/notification_data_conversions.h",
    "notifications/notification_dispatcher.cc",
    "notifications/notification_dispatcher.h",
    "notifications/notification_manager.cc",
    "notifications/notification_manager.h",
    "push_messaging/push_dispatcher.cc",
    "push_messaging/push_dispatcher.h",
    "push_messaging/push_provider.cc",
    "push_messaging/push_provider.h",
    "quota_dispatcher.cc",
    "quota_dispatcher.h",
    "quota_message_filter.cc",
    "quota_message_filter.h",
    "request_extra_data.cc",
    "request_extra_data.h",
    "resource_dispatcher.cc",
    "resource_dispatcher.h",
    "resource_scheduling_filter.cc",
    "resource_scheduling_filter.h",
    "runtime_features.cc",
    "runtime_features.h",
    "scoped_child_process_reference.cc",
    "scoped_child_process_reference.h",
    "scoped_web_callbacks.h",
    "service_factory.cc",
    "service_factory.h",
    "service_worker/service_worker_dispatcher.cc",
    "service_worker/service_worker_dispatcher.h",
    "service_worker/service_worker_handle_reference.cc",
    "service_worker/service_worker_handle_reference.h",
    "service_worker/service_worker_message_filter.cc",
    "service_worker/service_worker_message_filter.h",
    "service_worker/service_worker_network_provider.cc",
    "service_worker/service_worker_network_provider.h",
    "service_worker/service_worker_provider_context.cc",
    "service_worker/service_worker_provider_context.h",
    "service_worker/service_worker_registration_handle_reference.cc",
    "service_worker/service_worker_registration_handle_reference.h",
    "service_worker/web_service_worker_impl.cc",
    "service_worker/web_service_worker_impl.h",
    "service_worker/web_service_worker_provider_impl.cc",
    "service_worker/web_service_worker_provider_impl.h",
    "service_worker/web_service_worker_registration_impl.cc",
    "service_worker/web_service_worker_registration_impl.h",
    "shared_memory_data_consumer_handle.cc",
    "shared_memory_data_consumer_handle.h",
    "shared_memory_received_data_factory.cc",
    "shared_memory_received_data_factory.h",
    "shared_worker_devtools_agent.cc",
    "shared_worker_devtools_agent.h",
    "site_isolation_stats_gatherer.cc",
    "site_isolation_stats_gatherer.h",
    "storage_util.cc",
    "storage_util.h",
    "sync_load_response.cc",
    "sync_load_response.h",
    "thread_safe_sender.cc",
    "thread_safe_sender.h",
    "url_response_body_consumer.cc",
    "url_response_body_consumer.h",
    "v8_value_converter_impl.cc",
    "v8_value_converter_impl.h",
    "web_data_consumer_handle_impl.cc",
    "web_data_consumer_handle_impl.h",
    "web_database_observer_impl.cc",
    "web_database_observer_impl.h",
    "web_url_loader_impl.cc",
    "web_url_loader_impl.h",
    "web_url_request_util.cc",
    "web_url_request_util.h",
    "webfallbackthemeengine_impl.cc",
    "webfallbackthemeengine_impl.h",
    "webfileutilities_impl.cc",
    "webfileutilities_impl.h",
    "webmessageportchannel_impl.cc",
    "webmessageportchannel_impl.h",
    "webthemeengine_impl_android.cc",
    "webthemeengine_impl_android.h",
    "webthemeengine_impl_default.cc",
    "webthemeengine_impl_default.h",
    "webthemeengine_impl_mac.h",
    "weburlresponse_extradata_impl.cc",
    "weburlresponse_extradata_impl.h",
    "worker_thread_message_filter.cc",
    "worker_thread_message_filter.h",
    "worker_thread_registry.cc",
    "worker_thread_registry.h",
  ]

  if (appstore_compliant_code) {
    sources += [
      "webthemeengine_impl_mac.cc"
    ]
  }

  configs += [ "//build/config:precompiled_headers" ]

  public_deps = [
    "//gpu/ipc/client:client",
  ]

  deps = [
    "//base",
    "//components/discardable_memory/client",
    "//components/mime_util",
    "//components/tracing",
    "//components/tracing:startup_tracing",
    "//components/webcrypto",
    "//content/app/resources",
    "//content/app/strings",
    "//content/common",
    "//content/public/common:common_sources",
    "//crypto:platform",
    "//device/power_monitor/public/cpp",
    "//gpu/command_buffer/client",
    "//ipc",
    "//ipc:mojom",
    "//media",
    "//mojo/common",
    "//mojo/edk/system",
    "//net",
    "//services/service_manager/public/cpp",
    "//services/service_manager/public/interfaces",
    "//services/service_manager/runner/common",
    "//skia",
    "//storage/common",
    "//third_party/WebKit/public:blink_headers",
    "//third_party/WebKit/public:features",
    "//third_party/WebKit/public:image_resources",
    "//third_party/WebKit/public:resources",
    "//third_party/ced",
    "//ui/base",
    "//ui/events/gestures/blink",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/gl",
    "//ui/native_theme",
    "//url",
    "//v8",
  ]

  if (!use_default_render_theme) {
    sources -= [
      "webthemeengine_impl_default.cc",
      "webthemeengine_impl_default.h",
    ]
  }

  if (is_android) {
    deps += [ "//third_party/android_tools:cpu_features" ]
  }

  if (is_win) {
    libs = [ "dwrite.lib" ]
  }

  if (enable_plugins) {
    deps += [
      "//ppapi/proxy",
      "//ppapi/shared_impl",
    ]
  } else {
    sources -= [
      "browser_font_resource_trusted.cc",
      "browser_font_resource_trusted.h",
    ]
  }

  configs += [
    "//content:content_implementation",
    "//build/config/compiler:no_size_t_to_int_warning",
  ]
}

# See comment at the top of //content/BUILD.gn for how this works.
group("for_content_tests") {
  visibility = [ "//content/test/*" ]
  if (!is_component_build) {
    public_deps = [
      ":child",
    ]
  }
}
