Compile remoting client plugin with GN

BUG=512899

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

Cr-Commit-Position: refs/heads/master@{#348752}
diff --git a/net/BUILD.gn b/net/BUILD.gn
index b626e4a..0add477 100644
--- a/net/BUILD.gn
+++ b/net/BUILD.gn
@@ -88,8 +88,7 @@
 }
 
 # net_shared_* are settings shared between net and net_small
-net_shared_sources =
-    gypi_values.net_nacl_common_sources + gypi_values.net_non_nacl_sources
+net_shared_sources = gypi_values.net_nacl_common_sources
 
 net_shared_unfiltered_sources = []
 
@@ -110,284 +109,293 @@
 net_shared_deps = [
   ":net_resources",
   "//base",
-  "//base:prefs",
-  "//base/third_party/dynamic_annotations",
   "//net/base/registry_controlled_domains",
-  "//sdch",
   "//third_party/protobuf:protobuf_lite",
-  "//third_party/zlib",
 ]
 
-if (!use_kerberos) {
-  net_shared_sources -= [
-    "http/http_auth_gssapi_posix.cc",
-    "http/http_auth_gssapi_posix.h",
-    "http/http_auth_handler_negotiate.cc",
-    "http/http_auth_handler_negotiate.h",
-  ]
-}
+if (!is_nacl) {
+  net_shared_sources += gypi_values.net_non_nacl_sources
 
-if (is_posix) {
-  if (posix_avoid_mmap) {
-    net_shared_sources -= [ "disk_cache/blockfile/mapped_file_posix.cc" ]
+  net_shared_deps += [
+    "//base:prefs",
+    "//base/third_party/dynamic_annotations",
+    "//sdch",
+    "//third_party/zlib",
+  ]
+
+  if (!use_kerberos) {
+    net_shared_sources -= [
+      "http/http_auth_gssapi_posix.cc",
+      "http/http_auth_gssapi_posix.h",
+      "http/http_auth_handler_negotiate.cc",
+      "http/http_auth_handler_negotiate.h",
+    ]
+  }
+
+  if (is_posix) {
+    if (posix_avoid_mmap) {
+      net_shared_sources -= [ "disk_cache/blockfile/mapped_file_posix.cc" ]
+    } else {
+      net_shared_sources -=
+          [ "disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc" ]
+    }
+  }
+
+  if (!enable_built_in_dns) {
+    net_shared_sources -= [
+      "dns/address_sorter_posix.cc",
+      "dns/address_sorter_posix.h",
+      "dns/dns_client.cc",
+    ]
+  }
+
+  if (use_openssl) {
+    net_shared_sources -= [
+      "base/nss_memio.c",
+      "base/nss_memio.h",
+      "cert/ct_log_verifier_nss.cc",
+      "cert/ct_objects_extractor_nss.cc",
+      "cert/jwk_serializer_nss.cc",
+      "cert/scoped_nss_types.h",
+      "cert/x509_util_nss.cc",
+      "quic/crypto/aead_base_decrypter_nss.cc",
+      "quic/crypto/aead_base_encrypter_nss.cc",
+      "quic/crypto/aes_128_gcm_12_decrypter_nss.cc",
+      "quic/crypto/aes_128_gcm_12_encrypter_nss.cc",
+      "quic/crypto/chacha20_poly1305_decrypter_nss.cc",
+      "quic/crypto/chacha20_poly1305_encrypter_nss.cc",
+      "quic/crypto/channel_id_nss.cc",
+      "quic/crypto/p256_key_exchange_nss.cc",
+      "quic/crypto/proof_source_chromium_nss.cc",
+      "socket/nss_ssl_util.cc",
+      "socket/nss_ssl_util.h",
+      "socket/ssl_client_socket_nss.cc",
+      "socket/ssl_client_socket_nss.h",
+      "socket/ssl_server_socket_nss.cc",
+      "socket/ssl_server_socket_nss.h",
+    ]
+    if (is_ios) {
+      # Always removed for !ios below.
+      net_shared_sources -= [
+        "cert/cert_verify_proc_nss.cc",
+        "cert/cert_verify_proc_nss.h",
+      ]
+    }
+    if (is_win) {
+      net_shared_sources -= [ "cert/sha256_legacy_support_nss_win.cc" ]
+    }
+    if (!use_nss_certs && !is_ios) {
+      net_shared_sources -= [ "cert/x509_util_nss.h" ]
+    }
   } else {
-    net_shared_sources -=
-        [ "disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc" ]
-  }
-}
-
-if (!enable_built_in_dns) {
-  net_shared_sources -= [
-    "dns/address_sorter_posix.cc",
-    "dns/address_sorter_posix.h",
-    "dns/dns_client.cc",
-  ]
-}
-
-if (use_openssl) {
-  net_shared_sources -= [
-    "base/nss_memio.c",
-    "base/nss_memio.h",
-    "cert/ct_log_verifier_nss.cc",
-    "cert/ct_objects_extractor_nss.cc",
-    "cert/jwk_serializer_nss.cc",
-    "cert/scoped_nss_types.h",
-    "cert/x509_util_nss.cc",
-    "quic/crypto/aead_base_decrypter_nss.cc",
-    "quic/crypto/aead_base_encrypter_nss.cc",
-    "quic/crypto/aes_128_gcm_12_decrypter_nss.cc",
-    "quic/crypto/aes_128_gcm_12_encrypter_nss.cc",
-    "quic/crypto/chacha20_poly1305_decrypter_nss.cc",
-    "quic/crypto/chacha20_poly1305_encrypter_nss.cc",
-    "quic/crypto/channel_id_nss.cc",
-    "quic/crypto/p256_key_exchange_nss.cc",
-    "quic/crypto/proof_source_chromium_nss.cc",
-    "socket/nss_ssl_util.cc",
-    "socket/nss_ssl_util.h",
-    "socket/ssl_client_socket_nss.cc",
-    "socket/ssl_client_socket_nss.h",
-    "socket/ssl_server_socket_nss.cc",
-    "socket/ssl_server_socket_nss.h",
-  ]
-  if (is_ios) {
-    # Always removed for !ios below.
     net_shared_sources -= [
-      "cert/cert_verify_proc_nss.cc",
-      "cert/cert_verify_proc_nss.h",
+      "cert/ct_log_verifier_openssl.cc",
+      "cert/ct_objects_extractor_openssl.cc",
+      "cert/jwk_serializer_openssl.cc",
+      "cert/x509_util_openssl.cc",
+      "cert/x509_util_openssl.h",
+      "quic/crypto/aead_base_decrypter_openssl.cc",
+      "quic/crypto/aead_base_encrypter_openssl.cc",
+      "quic/crypto/aes_128_gcm_12_decrypter_openssl.cc",
+      "quic/crypto/aes_128_gcm_12_encrypter_openssl.cc",
+      "quic/crypto/chacha20_poly1305_decrypter_openssl.cc",
+      "quic/crypto/chacha20_poly1305_encrypter_openssl.cc",
+      "quic/crypto/channel_id_openssl.cc",
+      "quic/crypto/p256_key_exchange_openssl.cc",
+      "quic/crypto/proof_source_chromium_openssl.cc",
+      "quic/crypto/scoped_evp_aead_ctx.cc",
+      "quic/crypto/scoped_evp_aead_ctx.h",
+      "socket/ssl_client_socket_openssl.cc",
+      "socket/ssl_client_socket_openssl.h",
+      "socket/ssl_server_socket_openssl.cc",
+      "socket/ssl_server_socket_openssl.h",
+      "ssl/openssl_ssl_util.cc",
+      "ssl/openssl_ssl_util.h",
+      "ssl/ssl_client_session_cache_openssl.cc",
+      "ssl/ssl_client_session_cache_openssl.h",
+      "ssl/ssl_platform_key.h",
+      "ssl/threaded_ssl_private_key.cc",
+      "ssl/threaded_ssl_private_key.h",
     ]
+    if (is_mac) {
+      net_shared_sources -= [ "ssl/ssl_platform_key_mac.cc" ]
+    }
+    if (is_android) {
+      net_shared_sources -= [ "ssl/ssl_platform_key_android.cc" ]
+    }
+    if (is_win) {
+      net_shared_sources -= [
+        "cert/sha256_legacy_support_openssl_win.cc",
+        "ssl/ssl_platform_key_win.cc",
+      ]
+    }
+    if (use_nss_certs) {
+      net_shared_sources -= [
+        "ssl/client_key_store.cc",
+        "ssl/client_key_store.h",
+        "ssl/ssl_platform_key_nss.cc",
+      ]
+    }
   }
-  if (is_win) {
-    net_shared_sources -= [ "cert/sha256_legacy_support_nss_win.cc" ]
-  }
-  if (!use_nss_certs && !is_ios) {
-    net_shared_sources -= [ "cert/x509_util_nss.h" ]
-  }
-} else {
-  net_shared_sources -= [
-    "cert/ct_log_verifier_openssl.cc",
-    "cert/ct_objects_extractor_openssl.cc",
-    "cert/jwk_serializer_openssl.cc",
-    "cert/x509_util_openssl.cc",
-    "cert/x509_util_openssl.h",
-    "quic/crypto/aead_base_decrypter_openssl.cc",
-    "quic/crypto/aead_base_encrypter_openssl.cc",
-    "quic/crypto/aes_128_gcm_12_decrypter_openssl.cc",
-    "quic/crypto/aes_128_gcm_12_encrypter_openssl.cc",
-    "quic/crypto/chacha20_poly1305_decrypter_openssl.cc",
-    "quic/crypto/chacha20_poly1305_encrypter_openssl.cc",
-    "quic/crypto/channel_id_openssl.cc",
-    "quic/crypto/p256_key_exchange_openssl.cc",
-    "quic/crypto/proof_source_chromium_openssl.cc",
-    "quic/crypto/scoped_evp_aead_ctx.cc",
-    "quic/crypto/scoped_evp_aead_ctx.h",
-    "socket/ssl_client_socket_openssl.cc",
-    "socket/ssl_client_socket_openssl.h",
-    "socket/ssl_server_socket_openssl.cc",
-    "socket/ssl_server_socket_openssl.h",
-    "ssl/openssl_ssl_util.cc",
-    "ssl/openssl_ssl_util.h",
-    "ssl/ssl_client_session_cache_openssl.cc",
-    "ssl/ssl_client_session_cache_openssl.h",
-    "ssl/ssl_platform_key.h",
-    "ssl/threaded_ssl_private_key.cc",
-    "ssl/threaded_ssl_private_key.h",
-  ]
-  if (is_mac) {
-    net_shared_sources -= [ "ssl/ssl_platform_key_mac.cc" ]
-  }
-  if (is_android) {
-    net_shared_sources -= [ "ssl/ssl_platform_key_android.cc" ]
-  }
-  if (is_win) {
+
+  if (!use_openssl_certs) {
     net_shared_sources -= [
-      "cert/sha256_legacy_support_openssl_win.cc",
-      "ssl/ssl_platform_key_win.cc",
+      "base/crypto_module_openssl.cc",
+      "base/keygen_handler_openssl.cc",
+      "base/openssl_private_key_store.h",
+      "base/openssl_private_key_store_memory.cc",
+      "cert/cert_database_openssl.cc",
+      "cert/cert_verify_proc_openssl.cc",
+      "cert/cert_verify_proc_openssl.h",
+      "cert/test_root_certs_openssl.cc",
+      "cert/x509_certificate_openssl.cc",
+      "ssl/openssl_client_key_store.cc",
+      "ssl/openssl_client_key_store.h",
     ]
+    if (is_android) {
+      net_shared_sources -= [ "base/openssl_private_key_store_android.cc" ]
+    }
+  } else {
+    if (is_android) {
+      # Android doesn't use these even when using OpenSSL.
+      net_shared_sources -= [
+        "base/openssl_private_key_store_memory.cc",
+        "cert/cert_database_openssl.cc",
+        "cert/cert_verify_proc_openssl.cc",
+        "cert/test_root_certs_openssl.cc",
+      ]
+    }
   }
-  if (use_nss_certs) {
+
+  if (use_glib && !is_chromeos) {
+    net_shared_configs += [ "//build/config/linux:gconf" ]
+    net_shared_deps += [ "//build/linux:gio" ]
+  }
+
+  if (is_linux) {
+    net_shared_configs += [ "//build/config/linux:libresolv" ]
+  }
+
+  if (!use_nss_certs) {
+    net_shared_sources -= [
+      "base/crypto_module_nss.cc",
+      "base/keygen_handler_nss.cc",
+      "cert/cert_database_nss.cc",
+      "cert/nss_cert_database.cc",
+      "cert/nss_cert_database.h",
+      "cert/x509_certificate_nss.cc",
+      "ssl/client_cert_store_nss.cc",
+      "ssl/client_cert_store_nss.h",
+      "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
+      "third_party/mozilla_security_manager/nsKeygenHandler.h",
+      "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
+      "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
+      "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
+      "third_party/mozilla_security_manager/nsPKCS12Blob.h",
+    ]
+    if (!is_ios) {
+      # These files are part of the partial implementation of NSS on iOS so
+      # keep them in that case (even though use_nss_certs is not set).
+      net_shared_sources -= [
+        "cert/cert_verify_proc_nss.cc",
+        "cert/cert_verify_proc_nss.h",
+        "cert/test_root_certs_nss.cc",
+        "cert/x509_util_nss_certs.cc",
+        "cert_net/nss_ocsp.cc",
+        "cert_net/nss_ocsp.h",
+      ]
+    }
+    if (is_chromeos) {
+      # These were already removed on non-ChromeOS.
+      net_shared_sources -= [
+        "cert/nss_cert_database_chromeos.cc",
+        "cert/nss_cert_database_chromeos.h",
+        "cert/nss_profile_filter_chromeos.cc",
+        "cert/nss_profile_filter_chromeos.h",
+      ]
+    }
     net_shared_sources -= [
       "ssl/client_key_store.cc",
       "ssl/client_key_store.h",
       "ssl/ssl_platform_key_nss.cc",
     ]
+  } else if (use_openssl) {
+    # client_cert_store_nss.c requires NSS_CmpCertChainWCANames from NSS's
+    # libssl, but our bundled copy is not built in OpenSSL ports. Pull that file
+    # in directly.
+    net_shared_sources += [ "third_party/nss/ssl/cmpcert.c" ]
   }
-}
 
-if (!use_openssl_certs) {
-  net_shared_sources -= [
-    "base/crypto_module_openssl.cc",
-    "base/keygen_handler_openssl.cc",
-    "base/openssl_private_key_store.h",
-    "base/openssl_private_key_store_memory.cc",
-    "cert/cert_database_openssl.cc",
-    "cert/cert_verify_proc_openssl.cc",
-    "cert/cert_verify_proc_openssl.h",
-    "cert/test_root_certs_openssl.cc",
-    "cert/x509_certificate_openssl.cc",
-    "ssl/openssl_client_key_store.cc",
-    "ssl/openssl_client_key_store.h",
-  ]
+  if (!enable_mdns) {
+    net_shared_sources -= [
+      "dns/mdns_cache.cc",
+      "dns/mdns_cache.h",
+      "dns/mdns_client.cc",
+      "dns/mdns_client.h",
+      "dns/mdns_client_impl.cc",
+      "dns/mdns_client_impl.h",
+      "dns/record_parsed.cc",
+      "dns/record_parsed.h",
+      "dns/record_rdata.cc",
+      "dns/record_rdata.h",
+    ]
+  }
+
+  if (is_win) {
+    net_shared_sources -= [ "http/http_auth_handler_ntlm_portable.cc" ]
+  } else {  # !is_win
+    net_shared_sources -= [
+      "base/winsock_init.cc",
+      "base/winsock_init.h",
+      "base/winsock_util.cc",
+      "base/winsock_util.h",
+      "proxy/proxy_resolver_winhttp.cc",
+      "proxy/proxy_resolver_winhttp.h",
+    ]
+  }
+
+  if (is_ios) {
+    # Add back some sources that were otherwise filtered out. iOS needs some Mac
+    # files.
+    net_shared_unfiltered_sources += [
+      "base/mac/url_conversions.h",
+      "base/mac/url_conversions.mm",
+      "base/network_change_notifier_mac.cc",
+      "base/network_config_watcher_mac.cc",
+      "base/network_interfaces_mac.cc",
+      "base/network_interfaces_mac.h",
+      "base/platform_mime_util_mac.mm",
+      "proxy/proxy_resolver_mac.cc",
+      "proxy/proxy_server_mac.cc",
+    ]
+
+    net_shared_sources -= [ "disk_cache/blockfile/file_posix.cc" ]
+    net_shared_deps += [
+      "//third_party/nss:nspr",
+      "//third_party/nss",
+      "//net/third_party/nss/ssl:libssl",
+    ]
+  }
+
+  if (is_ios || is_mac) {
+    net_shared_sources += gypi_values.net_base_mac_ios_sources
+  }
+
   if (is_android) {
-    net_shared_sources -= [ "base/openssl_private_key_store_android.cc" ]
+    net_shared_deps += [ ":net_jni_headers" ]
+
+    # Add some Linux sources that were excluded by the filter, but which
+    # are needed.
+    net_shared_unfiltered_sources += [
+      "base/address_tracker_linux.cc",
+      "base/address_tracker_linux.h",
+      "base/network_interfaces_linux.cc",
+      "base/network_interfaces_linux.h",
+      "base/platform_mime_util_linux.cc",
+    ]
   }
 } else {
-  if (is_android) {
-    # Android doesn't use these even when using OpenSSL.
-    net_shared_sources -= [
-      "base/openssl_private_key_store_memory.cc",
-      "cert/cert_database_openssl.cc",
-      "cert/cert_verify_proc_openssl.cc",
-      "cert/test_root_certs_openssl.cc",
-    ]
-  }
-}
-
-if (use_glib && !is_chromeos) {
-  net_shared_configs += [ "//build/config/linux:gconf" ]
-  net_shared_deps += [ "//build/linux:gio" ]
-}
-
-if (is_linux) {
-  net_shared_configs += [ "//build/config/linux:libresolv" ]
-}
-
-if (!use_nss_certs) {
-  net_shared_sources -= [
-    "base/crypto_module_nss.cc",
-    "base/keygen_handler_nss.cc",
-    "cert/cert_database_nss.cc",
-    "cert/nss_cert_database.cc",
-    "cert/nss_cert_database.h",
-    "cert/x509_certificate_nss.cc",
-    "ssl/client_cert_store_nss.cc",
-    "ssl/client_cert_store_nss.h",
-    "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
-    "third_party/mozilla_security_manager/nsKeygenHandler.h",
-    "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
-    "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
-    "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
-    "third_party/mozilla_security_manager/nsPKCS12Blob.h",
-  ]
-  if (!is_ios) {
-    # These files are part of the partial implementation of NSS on iOS so
-    # keep them in that case (even though use_nss_certs is not set).
-    net_shared_sources -= [
-      "cert/cert_verify_proc_nss.cc",
-      "cert/cert_verify_proc_nss.h",
-      "cert/test_root_certs_nss.cc",
-      "cert/x509_util_nss_certs.cc",
-      "cert_net/nss_ocsp.cc",
-      "cert_net/nss_ocsp.h",
-    ]
-  }
-  if (is_chromeos) {
-    # These were already removed on non-ChromeOS.
-    net_shared_sources -= [
-      "cert/nss_cert_database_chromeos.cc",
-      "cert/nss_cert_database_chromeos.h",
-      "cert/nss_profile_filter_chromeos.cc",
-      "cert/nss_profile_filter_chromeos.h",
-    ]
-  }
-  net_shared_sources -= [
-    "ssl/client_key_store.cc",
-    "ssl/client_key_store.h",
-    "ssl/ssl_platform_key_nss.cc",
-  ]
-} else if (use_openssl) {
-  # client_cert_store_nss.c requires NSS_CmpCertChainWCANames from NSS's
-  # libssl, but our bundled copy is not built in OpenSSL ports. Pull that file
-  # in directly.
-  net_shared_sources += [ "third_party/nss/ssl/cmpcert.c" ]
-}
-
-if (!enable_mdns) {
-  net_shared_sources -= [
-    "dns/mdns_cache.cc",
-    "dns/mdns_cache.h",
-    "dns/mdns_client.cc",
-    "dns/mdns_client.h",
-    "dns/mdns_client_impl.cc",
-    "dns/mdns_client_impl.h",
-    "dns/record_parsed.cc",
-    "dns/record_parsed.h",
-    "dns/record_rdata.cc",
-    "dns/record_rdata.h",
-  ]
-}
-
-if (is_win) {
-  net_shared_sources -= [ "http/http_auth_handler_ntlm_portable.cc" ]
-} else {  # !is_win
-  net_shared_sources -= [
-    "base/winsock_init.cc",
-    "base/winsock_init.h",
-    "base/winsock_util.cc",
-    "base/winsock_util.h",
-    "proxy/proxy_resolver_winhttp.cc",
-    "proxy/proxy_resolver_winhttp.h",
-  ]
-}
-
-if (is_ios) {
-  # Add back some sources that were otherwise filtered out. iOS needs some Mac
-  # files.
-  net_shared_unfiltered_sources += [
-    "base/mac/url_conversions.h",
-    "base/mac/url_conversions.mm",
-    "base/network_change_notifier_mac.cc",
-    "base/network_config_watcher_mac.cc",
-    "base/network_interfaces_mac.cc",
-    "base/network_interfaces_mac.h",
-    "base/platform_mime_util_mac.mm",
-    "proxy/proxy_resolver_mac.cc",
-    "proxy/proxy_server_mac.cc",
-  ]
-
-  net_shared_sources -= [ "disk_cache/blockfile/file_posix.cc" ]
-  net_shared_deps += [
-    "//third_party/nss:nspr",
-    "//third_party/nss",
-    "//net/third_party/nss/ssl:libssl",
-  ]
-}
-
-if (is_ios || is_mac) {
-  net_shared_sources += gypi_values.net_base_mac_ios_sources
-}
-
-if (is_android) {
-  net_shared_deps += [ ":net_jni_headers" ]
-
-  # Add some Linux sources that were excluded by the filter, but which
-  # are needed.
-  net_shared_unfiltered_sources += [
-    "base/address_tracker_linux.cc",
-    "base/address_tracker_linux.h",
-    "base/network_interfaces_linux.cc",
-    "base/network_interfaces_linux.h",
-    "base/platform_mime_util_linux.cc",
-  ]
+  net_shared_public_deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
 }
 
 component("net") {
@@ -424,28 +432,30 @@
     ]
   }
 
-  if (!disable_file_support) {
-    sources += gypi_values.net_file_support_sources
-  }
+  if (!is_nacl) {
+    if (!disable_file_support) {
+      sources += gypi_values.net_file_support_sources
+    }
 
-  if (!disable_ftp_support) {
-    sources += gypi_values.net_ftp_support_sources
-  }
+    if (!disable_ftp_support) {
+      sources += gypi_values.net_ftp_support_sources
+    }
 
-  if (enable_websockets) {
-    sources += gypi_values.net_websockets_sources
-  }
+    if (enable_websockets) {
+      sources += gypi_values.net_websockets_sources
+    }
 
-  # ICU support.
-  deps += [
-    "//base:i18n",
-    "//third_party/icu",
-  ]
-  sources += [
-    "base/filename_util_icu.cc",
-    "base/net_string_util_icu.cc",
-    "base/net_util_icu.cc",
-  ]
+    # ICU support.
+    deps += [
+      "//base:i18n",
+      "//third_party/icu",
+    ]
+    sources += [
+      "base/filename_util_icu.cc",
+      "base/net_string_util_icu.cc",
+      "base/net_util_icu.cc",
+    ]
+  }
 }
 
 if (is_android) {