Misc SSLClientSocket cleanup inspired by NPN removal.

Remove GetNextProto(), because callers do not care if the negotiated protocol
was also on the server list or is the client fallback protocol (besides NPN has
been disabled for a while anyway).  They can just call GetNegotiatedProtocol()
instead.  This makes SSLSocketDataProvider::next_proto_status unused, so remove
that too.

Move GetNegotiatedProtocol() and WasNpnNegotiated() implementation from
SSLClientSocket to derived classes.  This must be done because they cannot rely
on GetNextProto() any longer.  This is cleaner though, because there is one
fewer layer.

Remove NextProtoStatus argument from NetLogHttpStreamProtoCallback, because now
that NPN is disabled, it does not carry useful information.

Rename SSLClientSocketImpl::npn_proto_ to negotiated_protocol_, because not only
NPN can be used to negotiate it.  In fact, NPN has been disabled for some time
now, so this rename is long overdue.

Change SSLSocketDataProvider::next_proto and
SSLClientSocketImpl::negotiated_protocol_ type from std::string to NextProto,
because logically that is the kind of information they hold.

Inline uses of now trivial SSLSocketDataProvider::SetNextProto().

Move RecordNegotiationExtension(), RecordChannelIDSupport(), and
IsChannelIDEnabled() from SSLClientSocket to SSLClientSocketImpl, because that
is the only derived class that calls them.  Also make them not static.

Move negotiation_extension_ from SSLClientSocket to SSLClientSocketImpl, because
that is the only derived class that uses it.  This member will be removed very
soon.

Change NextProtoFromString() to take base::StringPiece instead of std::string,
so that BoringSSL results do not have to be copied.

BUG=526713

Review-Url: https://codereview.chromium.org/2219133002
Cr-Commit-Position: refs/heads/master@{#411327}
diff --git a/net/socket/ssl_client_socket_impl.h b/net/socket/ssl_client_socket_impl.h
index 0abde087..ccb780b 100644
--- a/net/socket/ssl_client_socket_impl.h
+++ b/net/socket/ssl_client_socket_impl.h
@@ -73,7 +73,6 @@
 
   // SSLClientSocket implementation.
   void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override;
-  NextProtoStatus GetNextProto(std::string* proto) const override;
   ChannelIDService* GetChannelIDService() const override;
   Error GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key,
                                     std::vector<uint8_t>* out) override;
@@ -97,6 +96,8 @@
   void SetSubresourceSpeculation() override;
   void SetOmniboxSpeculation() override;
   bool WasEverUsed() const override;
+  bool WasNpnNegotiated() const override;
+  NextProto GetNegotiatedProtocol() const override;
   bool GetSSLInfo(SSLInfo* ssl_info) override;
   void GetConnectionAttempts(ConnectionAttempts* out) const override;
   void ClearConnectionAttempts() override {}
@@ -239,6 +240,17 @@
 
   void LogConnectEndEvent(int rv);
 
+  // Record which TLS extension was used to negotiate protocol and protocol
+  // chosen in a UMA histogram.
+  void RecordNegotiationExtension() const;
+
+  // Records histograms for channel id support during full handshakes - resumed
+  // handshakes are ignored.
+  void RecordChannelIDSupport() const;
+
+  // Returns whether TLS channel ID is enabled.
+  bool IsChannelIDEnabled() const;
+
   bool transport_send_busy_;
   bool transport_recv_busy_;
 
@@ -342,7 +354,9 @@
   bool disconnected_;
 
   NextProtoStatus npn_status_;
-  std::string npn_proto_;
+  NextProto negotiated_protocol_;
+  // Protocol negotiation extension used.
+  SSLNegotiationExtension negotiation_extension_;
   // Written by the |channel_id_service_|.
   std::unique_ptr<crypto::ECPrivateKey> channel_id_key_;
   // True if a channel ID was sent.