Fix Chrome linker errors in GN build.

This fixes all non-RTC-related linker errors for Chrome.

[email protected]

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

Cr-Commit-Position: refs/heads/master@{#292978}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 679aa87..443c700 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -68,6 +68,7 @@
     "//components/os_crypt",
     "//components/password_manager/core/browser",
     "//components/password_manager/core/common",
+    "//components/pdf/browser",
     "//components/policy:policy_component",
     "//components/precache/core",
     "//components/query_parser",
@@ -135,9 +136,6 @@
 
     defines = nacl_defines
 
-    # TODO(GYP) remove this when the real webrtc target is used below.
-    configs += [ "//content:webrtc_stub_config" ]
-
     deps += [
       "//apps",
       "//cc",
@@ -166,6 +164,7 @@
       "//mojo/public/cpp/bindings",
       "//mojo/public/js/bindings",
       "//mojo/system",
+      "//net:extras",
       "//net:net_with_v8",
       "//third_party/WebKit/public:resources",
       "//third_party/expat",
@@ -175,6 +174,7 @@
       "//third_party/npapi",
       "//third_party/re2",
       "//third_party/smhasher:cityhash",
+      "//third_party/webrtc/modules/desktop_capture",
       "//ui/gl",
       "//ui/surface",
       "//ui/web_dialogs",
@@ -184,8 +184,6 @@
       "//webkit/common:storage_common",
       ## TODO(tonyg): Remove this dependency (crbug.com/280157).
       #"../testing/perf/perf_test.gyp:*",  TODO(GYP)
-      # Note: for this one also remove the webrtc_stub_config
-      #"../third_party/webrtc/modules/modules.gyp:desktop_capture",  TODO(GYP)
     ]
   } else {  # iOS
     sources += rebase_path(gypi_values.chrome_browser_ios_sources,
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn
index 01603ea..58f750e 100644
--- a/chrome/browser/extensions/BUILD.gn
+++ b/chrome/browser/extensions/BUILD.gn
@@ -21,9 +21,6 @@
 
   defines = []
 
-  # TODO(GYP) remove this when webrtc is ported.
-  configs += [ "//content:webrtc_stub_config" ]
-
   # Since browser and browser_extensions actually depend on each other,
   # we must omit the dependency from browser_extensions to browser.
   # However, this means browser_extensions and browser should more or less
@@ -66,6 +63,7 @@
     "//third_party/icu",
     "//third_party/leveldatabase",
     "//third_party/re2",
+    "//third_party/webrtc/modules/desktop_capture",
     "//ui/accessibility:ax_gen",
     "//ui/base",
     "//ui/gfx",
@@ -75,7 +73,6 @@
     "//url",
     "//webkit/browser:storage",
     "//webkit/common:storage_common",
-    #"../third_party/webrtc/modules/modules.gyp:desktop_capture",  TODO(GYP)
   ]
 
   forward_dependent_configs_from = [
@@ -83,6 +80,11 @@
     "//content/public/browser",
   ]
 
+  # TODO(GYP) This config should be a direct_dependent_config of 
+  # //third_party/webrtc/modules/desktop_capture so we shouldn't have to
+  # include it here. Remove this line when the direct_dependent_config is set.
+  configs += [ "//third_party/webrtc:common_inherited_config" ]
+
   if (is_chromeos) {
     sources += rebase_path(
         gypi_values.chrome_browser_extensions_chromeos_sources,
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index e550199..02d0744 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -89,6 +89,7 @@
       "//chrome/common/extensions/api:api_registration",
       "//chrome/installer/util",
       "//components/autofill/content/browser:risk_proto",
+      "//components/power",
       "//device/bluetooth",
       "//device/nfc",
       "//media",
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn
index 45710c0..34e3ef21 100644
--- a/chrome/common/BUILD.gn
+++ b/chrome/common/BUILD.gn
@@ -211,11 +211,15 @@
     deps += [ "//remoting/client/plugin" ]
   }
   if (enable_plugins) {
+    sources += [
+      "pepper_flash.cc",
+      "pepper_flash.h",
+      "pepper_permission_util.cc",
+      "pepper_permission_util.h",
+    ]
     deps += [
       "//third_party/adobe/flash:flapper_version_h",
     ]
-  } else {
-    sources -= [ "pepper_permission_util.cc" ]
   }
   if (!enable_webrtc) {
     sources -= [ "media/webrtc_logging_messages.h" ]
diff --git a/chrome/renderer/BUILD.gn b/chrome/renderer/BUILD.gn
index 0cb4606..dbee281 100644
--- a/chrome/renderer/BUILD.gn
+++ b/chrome/renderer/BUILD.gn
@@ -39,6 +39,7 @@
     "//components/cdm/renderer",
     "//components/data_reduction_proxy/common",
     "//components/password_manager/content/renderer",
+    "//components/pdf/renderer",
     "//components/plugins/renderer",
     "//components/startup_metric_utils",
     "//components/translate/content/renderer",
diff --git a/components/gcm_driver/BUILD.gn b/components/gcm_driver/BUILD.gn
index 23421dc..6ee0dc6 100644
--- a/components/gcm_driver/BUILD.gn
+++ b/components/gcm_driver/BUILD.gn
@@ -18,6 +18,8 @@
     "gcm_client_factory.h",
     "gcm_client_impl.cc",
     "gcm_client_impl.h",
+    "gcm_connection_observer.cc",
+    "gcm_connection_observer.h",
     "gcm_driver.cc",
     "gcm_driver.h",
     "gcm_driver_android.cc",
diff --git a/content/BUILD.gn b/content/BUILD.gn
index 88f705b..b4eeb26 100644
--- a/content/BUILD.gn
+++ b/content/BUILD.gn
@@ -54,79 +54,3 @@
     "content/common/content_export.h"
   ]
 }
-
-# Stubs ------------------------------------------------------------------------
-
-# TODO(brettw) remove this and add a proper dependency on libjingle once that
-# target has been converted to GN. This config sets up the include directories
-# so content can compile in the meantime.
-config("libjingle_stub_config") {
-  include_dirs = [
-    "//third_party/libjingle/overrides",
-    "//third_party/libjingle/source",
-    "//third_party/libyuv/include",
-    "//third_party/usrsctp",
-
-
-    "//third_party/webrtc/overrides",  # Must be before webrtc abd third_party.
-    "//third_party/webrtc",
-    "//third_party",
-  ]
-
-  defines = [
-    "FEATURE_ENABLE_SSL",
-    "FEATURE_ENABLE_VOICEMAIL",
-    "EXPAT_RELATIVE_PATH",
-    "GTEST_RELATIVE_PATH",
-    "NO_MAIN_THREAD_WRAPPING",
-    "NO_SOUND_SYSTEM",
-  ]
-
-  if (is_mac) {
-    defines += [ "OSX", "WEBRTC_MAC" ]
-  } else if (is_linux) {
-    defines += [ "LINUX", "WEBRTC_LINUX" ]
-  } else if (is_android) {
-    defines += [ "ANDROID", "WEBRTC_LINUX", "WEBRTC_ANDROID" ]
-  } else if (is_win) {
-    libs = [ "secur32.lib", "crypt32.lib", "iphlpapi.lib" ]
-    defines += [ "WEBRTC_WIN" ]
-  }
-
-  if (is_posix) {
-    defines += [ "POSIX", "WEBRTC_POSIX" ]
-  }
-  if (is_chromeos) {
-    defines += [ "CHROMEOS" ]
-  }
-}
-
-# Sets up include dirs while webrtc is being converted to GN.
-# TODO(GYP) remove when webrtc is ready.
-config("webrtc_stub_config") {
-  defines = [ "WEBRTC_CHROMIUM_BUILD" ]
-  include_dirs = [
-    "//third_party/webrtc/overrides",  # Must be first.
-    "//third_party",
-  ]
-
-  if (is_mac) {
-    defines += [ "WEBRTC_MAC" ]
-  } else if (is_win) {
-    defines += [ "WEBRTC_WIN" ]
-  } else if (is_linux) {
-    defines += [ "WEBRTC_LINUX" ]
-  } else if (is_ios) {
-    defines += [ "WEBRTC_MAC", "WEBRTC_IOS" ]
-  } else if (is_android) {
-    defines += [ "WEBRTC_LINUX", "WEBRTC_ANDROID" ]
-    import("//build/config/crypto.gni")
-    if (use_openssl) {
-      defines += [ "WEBRTC_ANDROID_OPENSLEQS" ]
-    }
-  }
-
-  if (is_posix) {
-    defines += [ "WEBRTC_POSIX" ]
-  }
-}
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index b92154c..85798bf 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -113,8 +113,9 @@
 
   configs += [
     "//content:content_implementation",
-    "//content:libjingle_stub_config",  # TODO(GYP) remove when libjingle is ready.
-    "//content:webrtc_stub_config",  # TODO(GYP) remove when webrtc is ready.
+
+    # TODO(GYP) remove this when libjingle_webrtc is working.
+    "//third_party/libjingle:jingle_direct_dependent_configs",  # TODO(GYP)
   ]
 
   if (toolkit_views) {
@@ -156,11 +157,9 @@
   if (enable_webrtc) {
     sources += rebase_path(content_browser_gypi_values.webrtc_browser_sources,
                            ".", "//content")
-    # TODO(GYP)
-    #deps += [ "//jingle:glue" ]
+    deps += [ "//jingle:jingle_glue" ]
     if (is_linux) {
-      # TODO(GYP)
-      #deps += [ "//third_party/libjingle:libjingle_webrtc" ]
+      #deps += [ "//third_party/libjingle:libjingle_webrtc" ]  TODO(GYP)
     }
     if (is_linux || is_mac || is_win) {
       sources += [
@@ -176,8 +175,7 @@
         ]
       }
       defines += [ "ENABLE_SCREEN_CAPTURE=1" ]
-      # TODO(GYP)
-      #deps += [ "//third_party/webrtc/modules:desktop_capture" ]
+      deps += [ "//third_party/webrtc/modules/desktop_capture" ]
     }
   }
 
diff --git a/content/public/renderer/BUILD.gn b/content/public/renderer/BUILD.gn
index 4140205..37ccf23 100644
--- a/content/public/renderer/BUILD.gn
+++ b/content/public/renderer/BUILD.gn
@@ -11,12 +11,12 @@
 
   configs += [
     "//content:content_implementation",
-    "//content:libjingle_stub_config",
   ]
 
   deps = [
     "//content/renderer",
     "//skia",
+    "//third_party/libjingle",
     "//third_party/WebKit/public:blink_headers",
     "//third_party/widevine/cdm:version_h",
     "//v8",
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn
index 9d44fd1..45c3d0c 100644
--- a/content/renderer/BUILD.gn
+++ b/content/renderer/BUILD.gn
@@ -15,7 +15,6 @@
 
   configs += [
     "//content:content_implementation",
-    "//content:libjingle_stub_config",
   ]
 
   deps = [
@@ -129,10 +128,10 @@
     deps += [
       "//crypto",
       "//third_party/libyuv",
+      "//third_party/webrtc/modules/audio_device",
+      "//third_party/webrtc/modules/audio_processing",
       #"../third_party/libjingle/libjingle.gyp:libjingle_webrtc",  TODO(GYP)
       #"../third_party/libjingle/libjingle.gyp:libpeerconnection",  TODO(GYP)
-      #"../third_party/webrtc/modules/modules.gyp:audio_device",  TODO(GYP)
-      #"../third_party/webrtc/modules/modules.gyp:audio_processing",  TODO(GYP)
     ]
   } else {
     sources += [
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index 9ebf588..8218f3e 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -68,7 +68,7 @@
 
     if (enable_webrtc) {
       # TODO(GYP) remove this when libjingle is converted.
-      configs += [ "//content:libjingle_stub_config" ]
+      configs += [ "//third_party/libjingle:jingle_direct_dependent_configs" ]
 
       sources += [
         "../renderer/media/mock_media_stream_dispatcher.cc",
@@ -84,7 +84,7 @@
       deps += [
         #"//third_party/libjingle:webrtc",  TODO(GYP)
         #"//third_party/libjingle:peerconnection",  TODO(GYP)
-        #"//third_party/webrtc/modules:video_capture",  TODO(GYP)
+        "//third_party/webrtc/modules/video_capture",
       ]
     }
 
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn
index 03278c0..0b045ad 100644
--- a/extensions/browser/BUILD.gn
+++ b/extensions/browser/BUILD.gn
@@ -41,6 +41,8 @@
       "api/app_runtime/app_runtime_api.h",
       "api/app_view/app_view_internal_api.cc",
       "api/app_view/app_view_internal_api.h",
+      "api/guest_view/guest_view_internal_api.cc",
+      "api/guest_view/guest_view_internal_api.h",
       "api/async_api_function.cc",
       "api/async_api_function.h",
       "api/bluetooth/bluetooth_api.cc",
@@ -269,10 +271,21 @@
       "guest_view/guest_view_manager.cc",
       "guest_view/guest_view_manager.h",
       "guest_view/guest_view.h",
+      "guest_view/web_view/javascript_dialog_helper.cc",
+      "guest_view/web_view/javascript_dialog_helper.h",
+      "guest_view/web_view/web_view_constants.cc",
+      "guest_view/web_view/web_view_constants.h",
+      "guest_view/web_view/web_view_guest.cc",
+      "guest_view/web_view/web_view_guest.h",
       "guest_view/web_view/web_view_guest_delegate.cc",
       "guest_view/web_view/web_view_guest_delegate.h",
+      "guest_view/web_view/web_view_permission_types.h",
+      "guest_view/web_view/web_view_permission_helper.cc",
+      "guest_view/web_view/web_view_permission_helper.h",
       "guest_view/web_view/web_view_permission_helper_delegate.cc",
       "guest_view/web_view/web_view_permission_helper_delegate.h",
+      "guest_view/web_view/web_view_renderer_state.cc",
+      "guest_view/web_view/web_view_renderer_state.h",
       "image_loader.cc",
       "image_loader.h",
       "image_loader_factory.cc",
@@ -327,6 +340,10 @@
       "verified_contents.h",
       "view_type_utils.cc",
       "view_type_utils.h",
+      "warning_service.cc",
+      "warning_service.h",
+      "warning_set.cc",
+      "warning_set.h",
     ]
 
     deps += [
diff --git a/extensions/common/BUILD.gn b/extensions/common/BUILD.gn
index 7c26d6c7..05679dbf 100644
--- a/extensions/common/BUILD.gn
+++ b/extensions/common/BUILD.gn
@@ -108,6 +108,8 @@
     "manifest_handlers/incognito_info.h",
     "manifest_handlers/kiosk_mode_info.cc",
     "manifest_handlers/kiosk_mode_info.h",
+    "manifest_handlers/launcher_page_info.cc",
+    "manifest_handlers/launcher_page_info.h",
     "manifest_handlers/offline_enabled_info.cc",
     "manifest_handlers/offline_enabled_info.h",
     "manifest_handlers/permissions_parser.cc",
diff --git a/net/BUILD.gn b/net/BUILD.gn
index 89a4e90..9743f981 100644
--- a/net/BUILD.gn
+++ b/net/BUILD.gn
@@ -564,7 +564,7 @@
   ]
 }
 
-static_library("net_extras") {
+static_library("extras") {
   sources = gypi_values.net_extras_sources
   configs += [ "//build/config/compiler:wexit_time_destructors" ]
   deps = [
@@ -1104,9 +1104,9 @@
   defines = []
 
   deps = [
+    ":extras",
     ":http_server",
     ":net",
-    ":net_extras",
     ":quic_tools",
     ":test_support",
     "//base",
diff --git a/remoting/base/BUILD.gn b/remoting/base/BUILD.gn
index 46a2b70..3929a9f 100644
--- a/remoting/base/BUILD.gn
+++ b/remoting/base/BUILD.gn
@@ -66,8 +66,6 @@
   ]
 
   configs += [ "//build/config/compiler:wexit_time_destructors" ]
-  # TODO(GYP) Remove when WebRTC is converted.
-  configs += [ "//content:webrtc_stub_config" ]
 
   deps = [
     "//base",
@@ -81,7 +79,7 @@
     "//third_party/libyuv",
     "//third_party/opus",
     "//third_party/protobuf:protobuf_lite",
-    #"//third_party/webrtc/modules/desktop_capture",  TODO(GYP)
+    "//third_party/webrtc/modules/desktop_capture",
     "//ui/base",
     "//ui/gfx",
     "//ui/gfx/geometry",
@@ -93,5 +91,10 @@
     "//remoting/proto",
     "//third_party/protobuf:protobuf_lite",
   ]
+
+  # TODO(GYP) This config should be a direct_dependent_config of 
+  # //third_party/webrtc/modules/desktop_capture so we shouldn't have to
+  # include it here. Remove this line when the direct_dependent_config is set.
+  configs += [ "//third_party/webrtc:common_inherited_config" ]
 }
 
diff --git a/remoting/client/BUILD.gn b/remoting/client/BUILD.gn
index f944650..d2fde67 100644
--- a/remoting/client/BUILD.gn
+++ b/remoting/client/BUILD.gn
@@ -35,8 +35,6 @@
   ]
 
   configs += [ "//build/config/compiler:wexit_time_destructors" ]
-  # TODO(GYP) Remove when WebRTC is converted.
-  configs += [ "//content:webrtc_stub_config" ]
 
   defines = [ "VERSION=$version_full" ]
 
@@ -44,7 +42,7 @@
     "//remoting/base",
     "//remoting/protocol",
     "//third_party/libyuv",
-    #"//third_party/webrtc/modules/desktop_capture",  TODO(GYP)
+    "//third_party/webrtc/modules/desktop_capture",
     "//third_party/libwebm",
   ]
 }
diff --git a/remoting/client/plugin/BUILD.gn b/remoting/client/plugin/BUILD.gn
index a490488..3358d0c 100644
--- a/remoting/client/plugin/BUILD.gn
+++ b/remoting/client/plugin/BUILD.gn
@@ -52,7 +52,7 @@
     "//remoting/base",
     "//remoting/client",
     "//remoting/protocol",
-    #"//third_party/webrtc/modules/desktop_capture",  TODO(GYP)
+    "//third_party/webrtc/modules/desktop_capture",
     "//ui/events:dom4_keycode_converter",
   ]
 }
diff --git a/remoting/protocol/BUILD.gn b/remoting/protocol/BUILD.gn
index dc7598838..189e58841 100644
--- a/remoting/protocol/BUILD.gn
+++ b/remoting/protocol/BUILD.gn
@@ -136,25 +136,18 @@
   ]
 
   configs += [ "//build/config/compiler:wexit_time_destructors" ]
-  # TODO(GYP) Remove when WebRTC/jingle is converted.
-  configs += [
-    "//content:webrtc_stub_config",
-    "//content:libjingle_stub_config",
-  ]
 
   deps = [
     "//base",
     "//crypto",
+    "//jingle:jingle_glue",
+    "//jingle:notifier",
     "//net",
     "//remoting/base",
-    #'../jingle/jingle.gyp:jingle_glue',  TODO(GYP)
-    #'../jingle/jingle.gyp:notifier',  TODO(GYP)
-    #'../third_party/libjingle/libjingle.gyp:libjingle',  TODO(GYP)
+    "//third_party/libjingle",
   ]
 
   forward_dependent_configs_from = [
-    #'../third_party/libjingle/libjingle.gyp:libjingle',  TODO(GYP)
+    "//third_party/libjingle",
   ]
-  # TODO(GYP) Remove when jingle is converted.
-  direct_dependent_configs = [ "//content:libjingle_stub_config" ]
 }
diff --git a/third_party/libjingle/BUILD.gn b/third_party/libjingle/BUILD.gn
index 553b0a5d..3ab2c0bc 100644
--- a/third_party/libjingle/BUILD.gn
+++ b/third_party/libjingle/BUILD.gn
@@ -249,8 +249,7 @@
     "source/talk/p2p/base/constants.h",
   ]
   deps = [
-    # TODO(GYP): Uncomment when WebRTC GN build has settled.
-    # "//third_party/webrtc/base:webrtc_base",
+    "//third_party/webrtc/base:webrtc_base",
     ":libjingle_p2p_constants",
     ":jingle_deps"
   ]