Net: Plumb CNAME aliases to sockets with aim of exposing to ad-tagging.

The overall project aims to expose CNAME aliases to the
SubresourceFilter to aid in ad tagging and blocking.

A previous CL stored CNAME aliases in net::AddressList during
DNS resolution. This CL's parent added an accessor to
net::ResolveHostRequest/net::HostResolverManager::RequestImpl.

This change continues the plumbing by adding a base::Optional parameter
to net::ConnectJob::SetSocket.

net::Socket, on the other hand, gains both a getter and a setter for
the aliases, which need to be stored in the sockets in case of socket
reuse. But only three derived classes get a nontrivial implementation
with an actual field to store the aliases: net::TCPClientSocket,
net::SSLClientSocketImpl, and net::WebSocketStreamSocket.

Relevant tests:
net:net_unittests
out/Default/net_unittests --gtest_filter=*Dns*Alias*

Bug: 1151047
Change-Id: Ib1d8f6d8358aa445fad9051218336ec9953ff9b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563439
Commit-Queue: Cammie Smith Barnes <[email protected]>
Reviewed-by: Matt Menke <[email protected]>
Cr-Commit-Position: refs/heads/master@{#838179}
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index bcdbd8e..4566433 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -470,7 +470,7 @@
         return ERR_IO_PENDING;
       default:
         NOTREACHED();
-        SetSocket(std::unique_ptr<StreamSocket>());
+        SetSocket(std::unique_ptr<StreamSocket>(), base::nullopt);
         return ERR_FAILED;
     }
   }
@@ -481,14 +481,16 @@
     int result = OK;
     has_established_connection_ = true;
     if (succeed) {
-      SetSocket(std::make_unique<MockClientSocket>(net_log().net_log()));
+      SetSocket(std::make_unique<MockClientSocket>(net_log().net_log()),
+                base::nullopt);
       socket()->Connect(CompletionOnceCallback());
     } else if (cert_error) {
-      SetSocket(std::make_unique<MockClientSocket>(net_log().net_log()));
+      SetSocket(std::make_unique<MockClientSocket>(net_log().net_log()),
+                base::nullopt);
       result = ERR_CERT_COMMON_NAME_INVALID;
     } else {
       result = ERR_CONNECTION_FAILED;
-      SetSocket(std::unique_ptr<StreamSocket>());
+      SetSocket(std::unique_ptr<StreamSocket>(), base::nullopt);
     }
 
     if (was_async)