Make content/common compile on Linux GN build.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/293963007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271982 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index 21a8e13..511a55c 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -5,6 +5,8 @@
 # TODO(brettw) this file is a work in progress, it is not currently hooked up
 # to the build, but currently represents the state of content/common's deps.
 
+import("//build/config/features.gni")
+import("//build/config/ui.gni")
 import("//content/common/common.gni")
 
 source_set("common") {
@@ -16,11 +18,17 @@
 
   forward_dependent_configs_from = [
     # TODO(GYP) convert these dependencies.
-    #'../third_party/WebKit/public/blink_headers.gyp:blink_headers',
+    #"//third_party/WebKit/public:blink_headers",
+  ]
+
+  configs += [
+    "//content:blink_headers_stub_config",
+    "//content:libjingle_stub_config",
   ]
 
   deps = [
     "//base",
+    "//build/util:webkit_version",
     "//components/tracing",
     "//gpu/command_buffer/common",
     "//net",
@@ -32,8 +40,230 @@
     "//ui/gfx/geometry",
     "//url",
     # TODO(GYP) convert these dependencies.
-    #'../third_party/WebKit/public/blink_headers.gyp:blink_headers',
+    #"//third_party/WebKit/public:blink_headers",
     #'../third_party/libjingle/libjingle.gyp:libjingle',
     #'../ui/shell_dialogs/shell_dialogs.gyp:shell_dialogs',
   ]
+
+  if (!is_ios) {
+    deps += [
+      "//ipc",
+      "//gpu/command_buffer/client:gles2_c_lib",
+      "//gpu/command_buffer/client:gles2_implementation",
+      "//ui/gl",
+      #'../cc/cc.gyp:cc',
+      #'../gpu/gpu.gyp:command_buffer_service',
+      # TODO: the dependency on gl_in_process_context should be decoupled from
+      # content and moved to android_webview. See crbug.com/365797.
+      #'../gpu/gpu.gyp:gl_in_process_context',
+      #'../gpu/gpu.gyp:gpu_ipc',
+      #'../gpu/skia_bindings/skia_bindings.gyp:gpu_skia_bindings',
+      #'../media/media.gyp:media',
+      #'../media/media.gyp:shared_memory_support',
+      #'../mojo/mojo.gyp:mojo_environment_chromium',
+      #'../mojo/mojo.gyp:mojo_system_impl',
+      #'../third_party/WebKit/public/blink.gyp:blink',
+      #'../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu',
+      #'../webkit/common/webkit_common.gyp:webkit_common',
+      #'../webkit/storage_browser.gyp:webkit_storage_browser',
+      #'../webkit/storage_common.gyp:webkit_storage_common',
+    ]
+  }
+
+  include_dirs = []
+  defines = [ "CONTENT_IMPLEMENTATION" ]
+  libs = []
+  ldflags = []
+
+  if (is_android && use_seccomp_bpf) {
+    set_sources_assignment_filter([])
+    sources += [
+      "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
+      "sandbox_linux/sandbox_bpf_base_policy_linux.h",
+    ]
+    set_sources_assignment_filter(sources_assignment_filter)
+  }
+
+  if (is_mac) {
+    sources += [
+      "gpu/client/gpu_memory_buffer_impl_io_surface.cc",
+      "gpu/client/gpu_memory_buffer_impl_io_surface.h",
+    ]
+    sources -= [
+      "plugin_list_posix.cc",
+    ]
+
+    # TODO(GYP) enable when converted to GN.
+    #deps += [
+    #  "//webkit:webkit_resources",
+    #]
+    libs += [ "QuartzCore.framework" ]
+  }
+
+  if (is_android) {
+    sources += [
+      "gpu/client/gpu_memory_buffer_impl_surface_texture.cc",
+      "gpu/client/gpu_memory_buffer_impl_surface_texture.h",
+    ]
+
+    # TODO(GYP) enable when these targets are converted.
+    #deps += [
+    #  "//content:content_jni_headers",
+    #  "//content:common_aidl",
+    #]
+
+    libs += [ "android" ]
+  }
+
+  if (is_ios) {
+    sources -= [ "user_agent.cc" ]
+    assert(false, "Need to add lots of conditions here")
+  }
+
+  if (!use_ozone) {
+    sources -= [
+      "cursors/webcursor_ozone.cc",
+      "font_list_ozone.cc",
+    ]
+  }
+
+  if (!use_aura || !use_x11) {
+    sources -= [ "cursors/webcursor_aurax11.cc" ]
+  }
+
+  if (use_pango) {
+    configs += [ "//build/config/linux:pangocairo" ]
+    if (use_ozone) {
+      # If we're using pango, never use this ozone file (it was removed in all
+      # non-ozone cases above).
+      sources -= [ "font_list_ozone.cc" ]
+    }
+  } else {
+    sources -= [
+      "font_list_pango.cc",
+    ]
+  }
+
+  if (use_x11) {
+    include_dirs += [ "//third_party/khronos" ]
+    configs += [ "//build/config/linux:xcomposite" ]
+
+    if (cpu_arch != "arm" || !is_chromos) {
+      sources +=[
+        "gpu/x_util.cc",
+        "gpu/x_util.h",
+      ]
+    }
+  }
+
+  if (enable_plugins) {
+    deps += [
+      # TODO(GYP) enable once supported in the GN build.
+      #"//ppapi:shared",
+    ]
+  } else {
+    sources -= [
+      "pepper_plugin_list.cc",
+      "pepper_plugin_list.h",
+      "sandbox_util.cc",
+    ]
+  }
+
+  if (is_android) {
+    sources += [
+      "gpu/media/android_video_decode_accelerator.cc",
+      "gpu/media/android_video_decode_accelerator.h",
+    ]
+    deps += [
+      # TODO(GYP) enable once supported in the GN build.
+      #"//media",
+    ]
+
+    if (enable_webrtc) {
+      deps += [ "//third_party/libyuv" ]
+    }
+  }
+
+  if (is_chromeos && use_x11) {
+    if (cpu_arch == "arm") {
+      sources += [
+        "gpu/media/exynos_v4l2_video_device.cc",
+        "gpu/media/exynos_v4l2_video_device.h",
+        "gpu/media/tegra_v4l2_video_device.cc",
+        "gpu/media/tegra_v4l2_video_device.h",
+        "gpu/media/v4l2_image_processor.cc",
+        "gpu/media/v4l2_image_processor.h",
+        "gpu/media/v4l2_video_decode_accelerator.cc",
+        "gpu/media/v4l2_video_decode_accelerator.h",
+        "gpu/media/v4l2_video_device.cc",
+        "gpu/media/v4l2_video_device.h",
+        "gpu/media/v4l2_video_encode_accelerator.cc",
+        "gpu/media/v4l2_video_encode_accelerator.h",
+      ]
+      # TODO(GYP) enable once supported in the GN build.
+      #deps += [ "//media" ]
+      libs = [ "EGL", "GLESv2" ]
+    } else {  # !arm
+      sources += [
+        "gpu/media/h264_dpb.cc",
+        "gpu/media/h264_dpb.h",
+        "gpu/media/va_surface.h",
+        "gpu/media/vaapi_h264_decoder.cc",
+        "gpu/media/vaapi_h264_decoder.h",
+        "gpu/media/vaapi_video_decode_accelerator.cc",
+        "gpu/media/vaapi_video_decode_accelerator.h",
+        "gpu/media/vaapi_wrapper.cc",
+        "gpu/media/vaapi_wrapper.h",
+      ]
+      assert(false, "Implement generate_stubs for libva")
+    }
+  }
+
+  if (is_win) {
+    sources += [
+      "gpu/media/dxva_video_decode_accelerator.cc",
+      "gpu/media/dxva_video_decode_accelerator.h",
+    ]
+    include_dirs += [ "//third_party/khronos" ]
+    deps += [
+      # TODO(GYP) enable once supported in the GN build.
+      #"//media",
+      "//ui/gl",
+    ]
+
+    # TODO(GYP): extract_xinput action.
+  }
+
+  if (!is_win || !use_aura) {
+    sources -= [ "cursors/webcursor_aurawin.cc" ]
+  }
+  if (!use_aura || !use_x11) {
+    sources -= [ "cursors/webcursor_aurax11.cc" ]
+  }
+
+  if (use_seccomp_bpf) {
+    defines += [ "USE_SECCOMP_BPF" ]
+  } else {
+    if (is_linux) {
+      sources -= [
+        "sandbox_linux/bpf_cros_arm_gpu_policy_linux.cc",
+        "sandbox_linux/bpf_cros_arm_gpu_policy_linux.h",
+        "sandbox_linux/bpf_gpu_policy_linux.cc",
+        "sandbox_linux/bpf_gpu_policy_linux.h",
+        "sandbox_linux/bpf_ppapi_policy_linux.cc",
+        "sandbox_linux/bpf_ppapi_policy_linux.h",
+        "sandbox_linux/bpf_renderer_policy_linux.cc",
+        "sandbox_linux/bpf_renderer_policy_linux.h",
+        "sandbox_linux/sandbox_bpf_base_policy_linux.cc",
+        "sandbox_linux/sandbox_bpf_base_policy_linux.h",
+      ]
+    }
+    if (is_android) {
+      sources -= [
+        "sandbox_linux/android/sandbox_bpf_base_policy_android.cc",
+        "sandbox_linux/android/sandbox_bpf_base_policy_android.h",
+      ]
+    }
+  }
 }
+