# 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("//content/child/child.gni")

source_set("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/*",
  ]

  sources = rebase_path(content_child_gypi_values.private_child_sources,
                        ".",
                        "//content")

  configs += [
    "//build/config:precompiled_headers",
    "//content/public/common:mojo_shell_client",
  ]

  public_deps = [
    "//gpu/ipc/client:client",
    "//mojo/edk/system",
  ]

  deps = [
    "//base",
    "//components/mime_util",
    "//components/scheduler:scheduler",
    "//components/tracing",
    "//components/tracing:startup_tracing",
    "//components/webcrypto",
    "//content/app/resources",
    "//content/app/strings",
    "//content/common",
    "//crypto:platform",
    "//mojo/common",
    "//mojo/message_pump",
    "//mojo/shell/public/interfaces",
    "//mojo/shell/runner/common",
    "//net",
    "//skia",
    "//storage/common",
    "//third_party/WebKit/public:blink_headers",
    "//third_party/WebKit/public:image_resources",
    "//third_party/WebKit/public:resources",
    "//third_party/icu",
    "//third_party/npapi",
    "//ui/base",
    "//ui/events/gestures/blink",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/native_theme",
    "//url",
  ]

  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 (enable_plugins) {
    deps += [ "//ppapi/proxy" ]
  } else {
    sources -= [
      "browser_font_resource_trusted.cc",
      "npapi/plugin_host.cc",
      "npapi/plugin_host.h",
      "npapi/plugin_instance.cc",
      "npapi/plugin_instance.h",
      "npapi/plugin_lib.cc",
      "npapi/plugin_lib.h",
      "npapi/webplugin.h",
      "npapi/webplugin_delegate.h",
      "npapi/webplugin_delegate_impl.cc",
      "npapi/webplugin_delegate_impl.h",
      "npapi/webplugin_resource_client.h",
    ]

    if (is_mac) {
      sources -= [
        "npapi/plugin_instance_mac.mm",
        "npapi/plugin_web_event_converter_mac.h",
        "npapi/plugin_web_event_converter_mac.mm",
        "npapi/webplugin_accelerated_surface_mac.h",
        "npapi/webplugin_delegate_impl_mac.mm",
      ]
    } else if (is_win) {
      sources -= [ "npapi/webplugin_delegate_impl_win.cc" ]
    } else if (is_android) {
      sources -= [ "npapi/webplugin_delegate_impl_android.cc" ]
    }
    if (use_aura) {
      sources -= [ "npapi/webplugin_delegate_impl_aura.cc" ]
    }
  }

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

  if (use_aura && is_mac) {
    # This file is already excluded on non-Mac.
    sources -= [ "npapi/webplugin_delegate_impl_mac.mm" ]
  }

  if (is_win || !use_aura) {
    sources -= [ "npapi/webplugin_delegate_impl_aura.cc" ]
  }
}
