Remove HttpStreamBase.

HttpStreamBase was introduced to integrate the connection setup logic between
HTTP and WebSocket[1] by abstracting methods from HttpStream, but it is not
needed now. In addition to that, there is a downcast from HttpStreamBase to
HttpStream and that leads to a crash.

This CL moves all methods in HttpStreamBase to HttpStream and removes
HttpStreamBase.
This CL also replaces NULL with nullptr in some files.

1: https://chromium.googlesource.com/chromium/src/+/92b9a3e000136518c489975bebea57bc0f66333f
BUG=399535

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

Cr-Commit-Position: refs/heads/master@{#302967}
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index d29342e..eea7294 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -45,7 +45,7 @@
 #include "net/http/http_response_info.h"
 #include "net/http/http_server_properties.h"
 #include "net/http/http_status_code.h"
-#include "net/http/http_stream_base.h"
+#include "net/http/http_stream.h"
 #include "net/http/http_stream_factory.h"
 #include "net/http/http_util.h"
 #include "net/http/transport_security_state.h"
@@ -163,7 +163,7 @@
         stream_->Close(true /* not reusable */);
       } else {
         // Otherwise, we try to drain the response body.
-        HttpStreamBase* stream = stream_.release();
+        HttpStream* stream = stream_.release();
         stream->Drain(session_);
       }
     }
@@ -305,8 +305,7 @@
       // We should call connection_->set_idle_time(), but this doesn't occur
       // often enough to be worth the trouble.
       stream_->SetConnectionReused();
-      new_stream =
-          static_cast<HttpStream*>(stream_.get())->RenewStreamForAuth();
+      new_stream = stream_->RenewStreamForAuth();
     }
 
     if (!new_stream) {
@@ -421,8 +420,7 @@
   if (!stream_.get())
     return UploadProgress();
 
-  // TODO(bashi): This cast is temporary. Remove later.
-  return static_cast<HttpStream*>(stream_.get())->GetUploadProgress();
+  return stream_->GetUploadProgress();
 }
 
 void HttpNetworkTransaction::SetQuicServerInfo(
@@ -471,7 +469,7 @@
 
 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config,
                                            const ProxyInfo& used_proxy_info,
-                                           HttpStreamBase* stream) {
+                                           HttpStream* stream) {
   DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_);
   DCHECK(stream_request_.get());
 
@@ -564,7 +562,7 @@
     const HttpResponseInfo& response_info,
     const SSLConfig& used_ssl_config,
     const ProxyInfo& used_proxy_info,
-    HttpStreamBase* stream) {
+    HttpStream* stream) {
   DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_);
 
   headers_valid_ = true;
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index 47f34eb..e69e550 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -28,7 +28,7 @@
 class ClientSocketHandle;
 class HttpAuthController;
 class HttpNetworkSession;
-class HttpStreamBase;
+class HttpStream;
 class HttpStreamRequest;
 class IOBuffer;
 class ProxyInfo;
@@ -79,7 +79,7 @@
   // HttpStreamRequest::Delegate methods:
   void OnStreamReady(const SSLConfig& used_ssl_config,
                      const ProxyInfo& used_proxy_info,
-                     HttpStreamBase* stream) override;
+                     HttpStream* stream) override;
   void OnWebSocketHandshakeStreamReady(
       const SSLConfig& used_ssl_config,
       const ProxyInfo& used_proxy_info,
@@ -97,7 +97,7 @@
   void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info,
                                   const SSLConfig& used_ssl_config,
                                   const ProxyInfo& used_proxy_info,
-                                  HttpStreamBase* stream) override;
+                                  HttpStream* stream) override;
 
  private:
   friend class HttpNetworkTransactionSSLTest;
@@ -247,7 +247,7 @@
   // Debug helper.
   static std::string DescribeState(State state);
 
-  void SetStream(HttpStreamBase* stream);
+  void SetStream(HttpStream* stream);
 
   scoped_refptr<HttpAuthController>
       auth_controllers_[HttpAuth::AUTH_NUM_TARGETS];
@@ -271,7 +271,7 @@
   ProxyInfo proxy_info_;
 
   scoped_ptr<HttpStreamRequest> stream_request_;
-  scoped_ptr<HttpStreamBase> stream_;
+  scoped_ptr<HttpStream> stream_;
 
   // True if we've validated the headers that the stream parser has returned.
   bool headers_valid_;
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index be944935..dc02ec5 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -12193,8 +12193,8 @@
 
 namespace {
 
-// Fake HttpStreamBase that simply records calls to SetPriority().
-class FakeStream : public HttpStreamBase,
+// Fake HttpStream that simply records calls to SetPriority().
+class FakeStream : public HttpStream,
                    public base::SupportsWeakPtr<FakeStream> {
  public:
   explicit FakeStream(RequestPriority priority) : priority_(priority) {}
@@ -12274,6 +12274,10 @@
 
   void SetPriority(RequestPriority priority) override { priority_ = priority; }
 
+  UploadProgress GetUploadProgress() const override { return UploadProgress(); }
+
+  HttpStream* RenewStreamForAuth() override { return NULL; }
+
  private:
   RequestPriority priority_;
 
diff --git a/net/http/http_response_body_drainer.cc b/net/http/http_response_body_drainer.cc
index 91dbbf7..fdcec31 100644
--- a/net/http/http_response_body_drainer.cc
+++ b/net/http/http_response_body_drainer.cc
@@ -9,11 +9,11 @@
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
 #include "net/http/http_network_session.h"
-#include "net/http/http_stream_base.h"
+#include "net/http/http_stream.h"
 
 namespace net {
 
-HttpResponseBodyDrainer::HttpResponseBodyDrainer(HttpStreamBase* stream)
+HttpResponseBodyDrainer::HttpResponseBodyDrainer(HttpStream* stream)
     : stream_(stream),
       next_state_(STATE_NONE),
       total_read_(0),
diff --git a/net/http/http_response_body_drainer.h b/net/http/http_response_body_drainer.h
index 5c7713e..a4255d0d 100644
--- a/net/http/http_response_body_drainer.h
+++ b/net/http/http_response_body_drainer.h
@@ -15,7 +15,7 @@
 
 namespace net {
 
-class HttpStreamBase;
+class HttpStream;
 class IOBuffer;
 
 class NET_EXPORT_PRIVATE HttpResponseBodyDrainer {
@@ -27,7 +27,7 @@
   static const int kDrainBodyBufferSize = 16384;
   static const int kTimeoutInSeconds = 5;
 
-  explicit HttpResponseBodyDrainer(HttpStreamBase* stream);
+  explicit HttpResponseBodyDrainer(HttpStream* stream);
   ~HttpResponseBodyDrainer();
 
   // Starts reading the body until completion, or we hit the buffer limit, or we
@@ -52,7 +52,7 @@
   void Finish(int result);
 
   scoped_refptr<IOBuffer> read_buf_;
-  const scoped_ptr<HttpStreamBase> stream_;
+  const scoped_ptr<HttpStream> stream_;
   State next_state_;
   int total_read_;
   CompletionCallback user_callback_;
diff --git a/net/http/http_stream.h b/net/http/http_stream.h
index 3dda50b..3e8703d 100644
--- a/net/http/http_stream.h
+++ b/net/http/http_stream.h
@@ -12,19 +12,148 @@
 #define NET_HTTP_HTTP_STREAM_H_
 
 #include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
 #include "net/base/completion_callback.h"
 #include "net/base/net_export.h"
+#include "net/base/request_priority.h"
 #include "net/base/upload_progress.h"
-#include "net/http/http_stream_base.h"
 
 namespace net {
 
+class BoundNetLog;
+class HttpNetworkSession;
+class HttpRequestHeaders;
+struct HttpRequestInfo;
+class HttpResponseInfo;
 class IOBuffer;
+struct LoadTimingInfo;
+class SSLCertRequestInfo;
+class SSLInfo;
 
-class NET_EXPORT_PRIVATE HttpStream : public HttpStreamBase {
+class NET_EXPORT_PRIVATE HttpStream {
  public:
   HttpStream() {}
-  ~HttpStream() override {}
+  virtual ~HttpStream() {}
+
+  // Initialize stream.  Must be called before calling SendRequest().
+  // |request_info| must outlive the HttpStream.
+  // Returns a net error code, possibly ERR_IO_PENDING.
+  virtual int InitializeStream(const HttpRequestInfo* request_info,
+                               RequestPriority priority,
+                               const BoundNetLog& net_log,
+                               const CompletionCallback& callback) = 0;
+
+  // Writes the headers and uploads body data to the underlying socket.
+  // ERR_IO_PENDING is returned if the operation could not be completed
+  // synchronously, in which case the result will be passed to the callback
+  // when available. Returns OK on success.
+  //
+  // The callback will only be invoked once the first full set of headers have
+  // been received, at which point |response| will have been populated with that
+  // set of headers, and is safe to read, until/unless ReadResponseHeaders is
+  // called.
+  //
+  // |response| must remain valid until all sets of headers has been read, or
+  // the HttpStream is destroyed. There's typically only one set of
+  // headers, except in the case of 1xx responses (See ReadResponseHeaders).
+  virtual int SendRequest(const HttpRequestHeaders& request_headers,
+                          HttpResponseInfo* response,
+                          const CompletionCallback& callback) = 0;
+
+  // Reads from the underlying socket until the next set of response headers
+  // have been completely received.  This may only be called on 1xx responses
+  // after SendRequest has completed successfully, to read the next set of
+  // headers.
+  //
+  // ERR_IO_PENDING is returned if the operation could not be completed
+  // synchronously, in which case the result will be passed to the callback when
+  // available. Returns OK on success. The response headers are available in
+  // the HttpResponseInfo passed in to original call to SendRequest.
+  virtual int ReadResponseHeaders(const CompletionCallback& callback) = 0;
+
+  // Reads response body data, up to |buf_len| bytes. |buf_len| should be a
+  // reasonable size (<2MB). The number of bytes read is returned, or an
+  // error is returned upon failure.  0 indicates that the request has been
+  // fully satisfied and there is no more data to read.
+  // ERR_CONNECTION_CLOSED is returned when the connection has been closed
+  // prematurely.  ERR_IO_PENDING is returned if the operation could not be
+  // completed synchronously, in which case the result will be passed to the
+  // callback when available. If the operation is not completed immediately,
+  // the socket acquires a reference to the provided buffer until the callback
+  // is invoked or the socket is destroyed.
+  virtual int ReadResponseBody(IOBuffer* buf, int buf_len,
+                               const CompletionCallback& callback) = 0;
+
+  // Closes the stream.
+  // |not_reusable| indicates if the stream can be used for further requests.
+  // In the case of HTTP, where we re-use the byte-stream (e.g. the connection)
+  // this means we need to close the connection; in the case of SPDY, where the
+  // underlying stream is never reused, it has no effect.
+  // TODO(mbelshe): We should figure out how to fold the not_reusable flag
+  //                into the stream implementation itself so that the caller
+  //                does not need to pass it at all.  We might also be able to
+  //                eliminate the SetConnectionReused() below.
+  virtual void Close(bool not_reusable) = 0;
+
+  // Indicates if the response body has been completely read.
+  virtual bool IsResponseBodyComplete() const = 0;
+
+  // Indicates that the end of the response is detectable. This means that
+  // the response headers indicate either chunked encoding or content length.
+  // If neither is sent, the server must close the connection for us to detect
+  // the end of the response.
+  // TODO(rch): Rename this method, so that it is clear why it exists
+  // particularly as it applies to QUIC and SPDY for which the end of the
+  // response is always findable.
+  virtual bool CanFindEndOfResponse() const = 0;
+
+  // A stream exists on top of a connection.  If the connection has been used
+  // to successfully exchange data in the past, error handling for the
+  // stream is done differently.  This method returns true if the underlying
+  // connection is reused or has been connected and idle for some time.
+  virtual bool IsConnectionReused() const = 0;
+  virtual void SetConnectionReused() = 0;
+
+  // Checks whether the current state of the underlying connection
+  // allows it to be reused.
+  virtual bool IsConnectionReusable() const = 0;
+
+  // Get the total number of bytes received from network for this stream.
+  virtual int64 GetTotalReceivedBytes() const = 0;
+
+  // Populates the connection establishment part of |load_timing_info|, and
+  // socket ID.  |load_timing_info| must have all null times when called.
+  // Returns false and does nothing if there is no underlying connection, either
+  // because one has yet to be assigned to the stream, or because the underlying
+  // socket has been closed.
+  //
+  // In practice, this means that this function will always succeed any time
+  // between when the full headers have been received and the stream has been
+  // closed.
+  virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const = 0;
+
+  // Get the SSLInfo associated with this stream's connection.  This should
+  // only be called for streams over SSL sockets, otherwise the behavior is
+  // undefined.
+  virtual void GetSSLInfo(SSLInfo* ssl_info) = 0;
+
+  // Get the SSLCertRequestInfo associated with this stream's connection.
+  // This should only be called for streams over SSL sockets, otherwise the
+  // behavior is undefined.
+  virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) = 0;
+
+  // HACK(willchan): Really, we should move the HttpResponseDrainer logic into
+  // the HttpStream implementation. This is just a quick hack.
+  virtual bool IsSpdyHttpStream() const = 0;
+
+  // In the case of an HTTP error or redirect, flush the response body (usually
+  // a simple error or "this page has moved") so that we can re-use the
+  // underlying connection. This stream is responsible for deleting itself when
+  // draining is complete.
+  virtual void Drain(HttpNetworkSession* session) = 0;
+
+  // Called when the priority of the parent transaction changes.
+  virtual void SetPriority(RequestPriority priority) = 0;
 
   // Queries the UploadDataStream for its progress (bytes sent).
   virtual UploadProgress GetUploadProgress() const = 0;
diff --git a/net/http/http_stream_base.h b/net/http/http_stream_base.h
deleted file mode 100644
index 76e57ef..0000000
--- a/net/http/http_stream_base.h
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// HttpStreamBase is an interface for reading and writing data to an
-// HTTP-like stream that keeps the client agnostic of the actual underlying
-// transport layer.  This provides an abstraction for HttpStream and
-// WebSocketHandshakeStreamBase.
-
-#ifndef NET_HTTP_HTTP_STREAM_BASE_H_
-#define NET_HTTP_HTTP_STREAM_BASE_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "net/base/completion_callback.h"
-#include "net/base/net_export.h"
-#include "net/base/request_priority.h"
-#include "net/base/upload_progress.h"
-
-namespace net {
-
-class BoundNetLog;
-class HttpNetworkSession;
-class HttpRequestHeaders;
-struct HttpRequestInfo;
-class HttpResponseInfo;
-class IOBuffer;
-struct LoadTimingInfo;
-class SSLCertRequestInfo;
-class SSLInfo;
-
-class NET_EXPORT_PRIVATE HttpStreamBase {
- public:
-  HttpStreamBase() {}
-  virtual ~HttpStreamBase() {}
-
-  // Initialize stream.  Must be called before calling SendRequest().
-  // |request_info| must outlive the HttpStreamBase.
-  // Returns a net error code, possibly ERR_IO_PENDING.
-  virtual int InitializeStream(const HttpRequestInfo* request_info,
-                               RequestPriority priority,
-                               const BoundNetLog& net_log,
-                               const CompletionCallback& callback) = 0;
-
-  // Writes the headers and uploads body data to the underlying socket.
-  // ERR_IO_PENDING is returned if the operation could not be completed
-  // synchronously, in which case the result will be passed to the callback
-  // when available. Returns OK on success.
-  //
-  // The callback will only be invoked once the first full set of headers have
-  // been received, at which point |response| will have been populated with that
-  // set of headers, and is safe to read, until/unless ReadResponseHeaders is
-  // called.
-  //
-  // |response| must remain valid until all sets of headers has been read, or
-  // the HttpStreamBase is destroyed. There's typically only one set of
-  // headers, except in the case of 1xx responses (See ReadResponseHeaders).
-  virtual int SendRequest(const HttpRequestHeaders& request_headers,
-                          HttpResponseInfo* response,
-                          const CompletionCallback& callback) = 0;
-
-  // Reads from the underlying socket until the next set of response headers
-  // have been completely received.  This may only be called on 1xx responses
-  // after SendRequest has completed successfully, to read the next set of
-  // headers.
-  //
-  // ERR_IO_PENDING is returned if the operation could not be completed
-  // synchronously, in which case the result will be passed to the callback when
-  // available. Returns OK on success. The response headers are available in
-  // the HttpResponseInfo passed in to original call to SendRequest.
-  virtual int ReadResponseHeaders(const CompletionCallback& callback) = 0;
-
-  // Reads response body data, up to |buf_len| bytes. |buf_len| should be a
-  // reasonable size (<2MB). The number of bytes read is returned, or an
-  // error is returned upon failure.  0 indicates that the request has been
-  // fully satisfied and there is no more data to read.
-  // ERR_CONNECTION_CLOSED is returned when the connection has been closed
-  // prematurely.  ERR_IO_PENDING is returned if the operation could not be
-  // completed synchronously, in which case the result will be passed to the
-  // callback when available. If the operation is not completed immediately,
-  // the socket acquires a reference to the provided buffer until the callback
-  // is invoked or the socket is destroyed.
-  virtual int ReadResponseBody(IOBuffer* buf, int buf_len,
-                               const CompletionCallback& callback) = 0;
-
-  // Closes the stream.
-  // |not_reusable| indicates if the stream can be used for further requests.
-  // In the case of HTTP, where we re-use the byte-stream (e.g. the connection)
-  // this means we need to close the connection; in the case of SPDY, where the
-  // underlying stream is never reused, it has no effect.
-  // TODO(mbelshe): We should figure out how to fold the not_reusable flag
-  //                into the stream implementation itself so that the caller
-  //                does not need to pass it at all.  We might also be able to
-  //                eliminate the SetConnectionReused() below.
-  virtual void Close(bool not_reusable) = 0;
-
-  // Indicates if the response body has been completely read.
-  virtual bool IsResponseBodyComplete() const = 0;
-
-  // Indicates that the end of the response is detectable. This means that
-  // the response headers indicate either chunked encoding or content length.
-  // If neither is sent, the server must close the connection for us to detect
-  // the end of the response.
-  // TODO(rch): Rename this method, so that it is clear why it exists
-  // particularly as it applies to QUIC and SPDY for which the end of the
-  // response is always findable.
-  virtual bool CanFindEndOfResponse() const = 0;
-
-  // A stream exists on top of a connection.  If the connection has been used
-  // to successfully exchange data in the past, error handling for the
-  // stream is done differently.  This method returns true if the underlying
-  // connection is reused or has been connected and idle for some time.
-  virtual bool IsConnectionReused() const = 0;
-  virtual void SetConnectionReused() = 0;
-
-  // Checks whether the current state of the underlying connection
-  // allows it to be reused.
-  virtual bool IsConnectionReusable() const = 0;
-
-  // Get the total number of bytes received from network for this stream.
-  virtual int64 GetTotalReceivedBytes() const = 0;
-
-  // Populates the connection establishment part of |load_timing_info|, and
-  // socket ID.  |load_timing_info| must have all null times when called.
-  // Returns false and does nothing if there is no underlying connection, either
-  // because one has yet to be assigned to the stream, or because the underlying
-  // socket has been closed.
-  //
-  // In practice, this means that this function will always succeed any time
-  // between when the full headers have been received and the stream has been
-  // closed.
-  virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const = 0;
-
-  // Get the SSLInfo associated with this stream's connection.  This should
-  // only be called for streams over SSL sockets, otherwise the behavior is
-  // undefined.
-  virtual void GetSSLInfo(SSLInfo* ssl_info) = 0;
-
-  // Get the SSLCertRequestInfo associated with this stream's connection.
-  // This should only be called for streams over SSL sockets, otherwise the
-  // behavior is undefined.
-  virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) = 0;
-
-  // HACK(willchan): Really, we should move the HttpResponseDrainer logic into
-  // the HttpStream implementation. This is just a quick hack.
-  virtual bool IsSpdyHttpStream() const = 0;
-
-  // In the case of an HTTP error or redirect, flush the response body (usually
-  // a simple error or "this page has moved") so that we can re-use the
-  // underlying connection. This stream is responsible for deleting itself when
-  // draining is complete.
-  virtual void Drain(HttpNetworkSession* session) = 0;
-
-  // Called when the priority of the parent transaction changes.
-  virtual void SetPriority(RequestPriority priority) = 0;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(HttpStreamBase);
-};
-
-}  // namespace net
-
-#endif  // NET_HTTP_HTTP_STREAM_BASE_H_
diff --git a/net/http/http_stream_factory.h b/net/http/http_stream_factory.h
index 8f6d892..e6712623 100644
--- a/net/http/http_stream_factory.h
+++ b/net/http/http_stream_factory.h
@@ -37,7 +37,7 @@
 class HttpNetworkSession;
 class HttpResponseInfo;
 class HttpServerProperties;
-class HttpStreamBase;
+class HttpStream;
 class ProxyInfo;
 class SSLCertRequestInfo;
 class SSLInfo;
@@ -68,7 +68,7 @@
     virtual void OnStreamReady(
         const SSLConfig& used_ssl_config,
         const ProxyInfo& used_proxy_info,
-        HttpStreamBase* stream) = 0;
+        HttpStream* stream) = 0;
 
     // This is the success case for RequestWebSocketHandshakeStream.
     // |stream| is now owned by the delegate.
@@ -143,7 +143,7 @@
         const HttpResponseInfo& response_info,
         const SSLConfig& used_ssl_config,
         const ProxyInfo& used_proxy_info,
-        HttpStreamBase* stream) = 0;
+        HttpStream* stream) = 0;
   };
 
   virtual ~HttpStreamRequest() {}
diff --git a/net/http/http_stream_factory_impl_request.cc b/net/http/http_stream_factory_impl_request.cc
index 2cc497f..c4d1d07 100644
--- a/net/http/http_stream_factory_impl_request.cc
+++ b/net/http/http_stream_factory_impl_request.cc
@@ -90,7 +90,7 @@
     Job* job,
     const SSLConfig& used_ssl_config,
     const ProxyInfo& used_proxy_info,
-    HttpStreamBase* stream) {
+    HttpStream* stream) {
   DCHECK(!factory_->for_websockets_);
   DCHECK(stream);
   DCHECK(completed_);
@@ -185,7 +185,7 @@
     const HttpResponseInfo& response_info,
     const SSLConfig& used_ssl_config,
     const ProxyInfo& used_proxy_info,
-    HttpStreamBase* stream) {
+    HttpStream* stream) {
   if (!bound_job_.get())
     OrphanJobsExcept(job);
   else
diff --git a/net/http/http_stream_factory_impl_request.h b/net/http/http_stream_factory_impl_request.h
index 70def25..fd786f2 100644
--- a/net/http/http_stream_factory_impl_request.h
+++ b/net/http/http_stream_factory_impl_request.h
@@ -71,7 +71,7 @@
   void OnStreamReady(Job* job,
                      const SSLConfig& used_ssl_config,
                      const ProxyInfo& used_proxy_info,
-                     HttpStreamBase* stream);
+                     HttpStream* stream);
   void OnWebSocketHandshakeStreamReady(Job* job,
                                        const SSLConfig& used_ssl_config,
                                        const ProxyInfo& used_proxy_info,
@@ -94,7 +94,7 @@
       const HttpResponseInfo& response_info,
       const SSLConfig& used_ssl_config,
       const ProxyInfo& used_proxy_info,
-      HttpStreamBase* stream);
+      HttpStream* stream);
 
   // HttpStreamRequest methods.
 
diff --git a/net/http/http_stream_factory_impl_request_unittest.cc b/net/http/http_stream_factory_impl_request_unittest.cc
index e204c61..46950670 100644
--- a/net/http/http_stream_factory_impl_request_unittest.cc
+++ b/net/http/http_stream_factory_impl_request_unittest.cc
@@ -33,7 +33,7 @@
   // HttpStreamRequest::Delegate
   void OnStreamReady(const SSLConfig& used_ssl_config,
                      const ProxyInfo& used_proxy_info,
-                     HttpStreamBase* stream) override {}
+                     HttpStream* stream) override {}
   void OnWebSocketHandshakeStreamReady(
       const SSLConfig& used_ssl_config,
       const ProxyInfo& used_proxy_info,
@@ -51,7 +51,7 @@
   void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info,
                                   const SSLConfig& used_ssl_config,
                                   const ProxyInfo& used_proxy_info,
-                                  HttpStreamBase* stream) override {}
+                                  HttpStream* stream) override {}
 };
 
 }  // namespace
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc
index 1efbd468..4bf1659 100644
--- a/net/http/http_stream_factory_impl_unittest.cc
+++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -58,7 +58,7 @@
     return type_;
   }
 
-  // HttpStreamBase methods
+  // HttpStream methods
   int InitializeStream(const HttpRequestInfo* request_info,
                        RequestPriority priority,
                        const BoundNetLog& net_log,
@@ -93,6 +93,8 @@
   bool IsSpdyHttpStream() const override { return false; }
   void Drain(HttpNetworkSession* session) override {}
   void SetPriority(RequestPriority priority) override {}
+  UploadProgress GetUploadProgress() const override { return UploadProgress(); }
+  HttpStream* RenewStreamForAuth() override { return nullptr; }
 
   scoped_ptr<WebSocketStream> Upgrade() override {
     return scoped_ptr<WebSocketStream>();
@@ -142,7 +144,7 @@
 
   void OnStreamReady(const SSLConfig& used_ssl_config,
                      const ProxyInfo& used_proxy_info,
-                     HttpStreamBase* stream) override {
+                     HttpStream* stream) override {
     stream_done_ = true;
     if (waiting_for_stream_)
       base::MessageLoop::current()->Quit();
@@ -180,7 +182,7 @@
   void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info,
                                   const SSLConfig& used_ssl_config,
                                   const ProxyInfo& used_proxy_info,
-                                  HttpStreamBase* stream) override {}
+                                  HttpStream* stream) override {}
 
   void WaitForStream() {
     while (!stream_done_) {
@@ -198,7 +200,7 @@
     return used_proxy_info_;
   }
 
-  HttpStreamBase* stream() {
+  HttpStream* stream() {
     return stream_.get();
   }
 
@@ -211,7 +213,7 @@
  private:
   bool waiting_for_stream_;
   bool stream_done_;
-  scoped_ptr<HttpStreamBase> stream_;
+  scoped_ptr<HttpStream> stream_;
   scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_;
   SSLConfig used_ssl_config_;
   ProxyInfo used_proxy_info_;
@@ -382,14 +384,14 @@
 template<typename ParentPool>
 CapturePreconnectsSocketPool<ParentPool>::CapturePreconnectsSocketPool(
     HostResolver* host_resolver, CertVerifier* /* cert_verifier */)
-    : ParentPool(0, 0, NULL, host_resolver, NULL, NULL),
+    : ParentPool(0, 0, nullptr, host_resolver, nullptr, nullptr),
       last_num_streams_(-1) {}
 
 template<>
 CapturePreconnectsHttpProxySocketPool::CapturePreconnectsSocketPool(
     HostResolver* host_resolver, CertVerifier* /* cert_verifier */)
     : HttpProxyClientSocketPool(
-          0, 0, NULL, host_resolver, NULL, NULL, NULL, NULL),
+          0, 0, nullptr, host_resolver, nullptr, nullptr, nullptr, nullptr),
       last_num_streams_(-1) {}
 
 template <>
@@ -398,20 +400,20 @@
     CertVerifier* cert_verifier)
     : SSLClientSocketPool(0,
                           0,
-                          NULL,  // ssl_histograms
+                          nullptr,  // ssl_histograms
                           host_resolver,
                           cert_verifier,
-                          NULL,           // channel_id_store
-                          NULL,           // transport_security_state
-                          NULL,           // cert_transparency_verifier
+                          nullptr,           // channel_id_store
+                          nullptr,           // transport_security_state
+                          nullptr,           // cert_transparency_verifier
                           std::string(),  // ssl_session_cache_shard
-                          NULL,           // deterministic_socket_factory
-                          NULL,           // transport_socket_pool
-                          NULL,
-                          NULL,
-                          NULL,   // ssl_config_service
+                          nullptr,           // deterministic_socket_factory
+                          nullptr,           // transport_socket_pool
+                          nullptr,
+                          nullptr,
+                          nullptr,   // ssl_config_service
                           false,  // enable_ssl_connect_job_waiting
-                          NULL),  // net_log
+                          nullptr),  // net_log
       last_num_streams_(-1) {
 }
 
@@ -659,9 +661,9 @@
 int GetSocketPoolGroupCount(ClientSocketPool* pool) {
   int count = 0;
   scoped_ptr<base::DictionaryValue> dict(pool->GetInfoAsValue("", "", false));
-  EXPECT_TRUE(dict != NULL);
-  base::DictionaryValue* groups = NULL;
-  if (dict->GetDictionary("groups", &groups) && (groups != NULL)) {
+  EXPECT_TRUE(dict != nullptr);
+  base::DictionaryValue* groups = nullptr;
+  if (dict->GetDictionary("groups", &groups) && (groups != nullptr)) {
     count = static_cast<int>(groups->size());
   }
   return count;
@@ -778,8 +780,8 @@
           BoundNetLog()));
   waiter.WaitForStream();
   EXPECT_TRUE(waiter.stream_done());
-  ASSERT_TRUE(NULL != waiter.stream());
-  EXPECT_TRUE(NULL == waiter.websocket_stream());
+  ASSERT_TRUE(nullptr != waiter.stream());
+  EXPECT_TRUE(nullptr == waiter.websocket_stream());
   EXPECT_FALSE(waiter.stream()->IsSpdyHttpStream());
 
   EXPECT_EQ(1, GetSocketPoolGroupCount(
@@ -799,7 +801,7 @@
       GetParam(), ProxyService::CreateDirect());
 
   MockRead mock_read(ASYNC, OK);
-  StaticSocketDataProvider socket_data(&mock_read, 1, NULL, 0);
+  StaticSocketDataProvider socket_data(&mock_read, 1, nullptr, 0);
   socket_data.set_connect_data(MockConnect(ASYNC, OK));
   session_deps.socket_factory->AddSocketDataProvider(&socket_data);
 
@@ -827,8 +829,8 @@
           BoundNetLog()));
   waiter.WaitForStream();
   EXPECT_TRUE(waiter.stream_done());
-  ASSERT_TRUE(NULL != waiter.stream());
-  EXPECT_TRUE(NULL == waiter.websocket_stream());
+  ASSERT_TRUE(nullptr != waiter.stream());
+  EXPECT_TRUE(nullptr == waiter.websocket_stream());
   EXPECT_FALSE(waiter.stream()->IsSpdyHttpStream());
   EXPECT_EQ(1, GetSocketPoolGroupCount(
       session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
@@ -872,8 +874,8 @@
           BoundNetLog()));
   waiter.WaitForStream();
   EXPECT_TRUE(waiter.stream_done());
-  ASSERT_TRUE(NULL != waiter.stream());
-  EXPECT_TRUE(NULL == waiter.websocket_stream());
+  ASSERT_TRUE(nullptr != waiter.stream());
+  EXPECT_TRUE(nullptr == waiter.websocket_stream());
   EXPECT_FALSE(waiter.stream()->IsSpdyHttpStream());
   EXPECT_EQ(0, GetSocketPoolGroupCount(
       session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
@@ -925,8 +927,8 @@
                                             BoundNetLog()));
   waiter.WaitForStream();
   EXPECT_TRUE(waiter.stream_done());
-  EXPECT_TRUE(NULL == waiter.stream());
-  ASSERT_TRUE(NULL != waiter.websocket_stream());
+  EXPECT_TRUE(nullptr == waiter.stream());
+  ASSERT_TRUE(nullptr != waiter.websocket_stream());
   EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
             waiter.websocket_stream()->type());
   EXPECT_EQ(0, GetSocketPoolGroupCount(
@@ -943,7 +945,7 @@
       GetParam(), ProxyService::CreateDirect());
 
   MockRead mock_read(ASYNC, OK);
-  StaticSocketDataProvider socket_data(&mock_read, 1, NULL, 0);
+  StaticSocketDataProvider socket_data(&mock_read, 1, nullptr, 0);
   socket_data.set_connect_data(MockConnect(ASYNC, OK));
   session_deps.socket_factory->AddSocketDataProvider(&socket_data);
 
@@ -973,8 +975,8 @@
                                             BoundNetLog()));
   waiter.WaitForStream();
   EXPECT_TRUE(waiter.stream_done());
-  EXPECT_TRUE(NULL == waiter.stream());
-  ASSERT_TRUE(NULL != waiter.websocket_stream());
+  EXPECT_TRUE(nullptr == waiter.stream());
+  ASSERT_TRUE(nullptr != waiter.websocket_stream());
   EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
             waiter.websocket_stream()->type());
   EXPECT_EQ(0, GetSocketPoolGroupCount(
@@ -1018,8 +1020,8 @@
                                             BoundNetLog()));
   waiter.WaitForStream();
   EXPECT_TRUE(waiter.stream_done());
-  EXPECT_TRUE(NULL == waiter.stream());
-  ASSERT_TRUE(NULL != waiter.websocket_stream());
+  EXPECT_TRUE(nullptr == waiter.stream());
+  ASSERT_TRUE(nullptr != waiter.websocket_stream());
   EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
             waiter.websocket_stream()->type());
   EXPECT_EQ(0, GetSocketPoolGroupCount(
@@ -1047,7 +1049,7 @@
                                        ProxyService::CreateDirect());
 
   MockRead mock_read(ASYNC, OK);
-  DeterministicSocketData socket_data(&mock_read, 1, NULL, 0);
+  DeterministicSocketData socket_data(&mock_read, 1, nullptr, 0);
   socket_data.set_connect_data(MockConnect(ASYNC, OK));
   session_deps.deterministic_socket_factory->AddSocketDataProvider(
       &socket_data);
@@ -1080,8 +1082,8 @@
           BoundNetLog()));
   waiter.WaitForStream();
   EXPECT_TRUE(waiter.stream_done());
-  EXPECT_TRUE(NULL == waiter.websocket_stream());
-  ASSERT_TRUE(NULL != waiter.stream());
+  EXPECT_TRUE(nullptr == waiter.websocket_stream());
+  ASSERT_TRUE(nullptr != waiter.stream());
   EXPECT_TRUE(waiter.stream()->IsSpdyHttpStream());
   EXPECT_EQ(1, GetSocketPoolGroupCount(
       session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
@@ -1103,7 +1105,7 @@
                                        ProxyService::CreateDirect());
 
   MockRead mock_read(SYNCHRONOUS, ERR_IO_PENDING);
-  StaticSocketDataProvider socket_data(&mock_read, 1, NULL, 0);
+  StaticSocketDataProvider socket_data(&mock_read, 1, nullptr, 0);
   socket_data.set_connect_data(MockConnect(ASYNC, OK));
   session_deps.socket_factory->AddSocketDataProvider(&socket_data);
 
@@ -1134,10 +1136,10 @@
                                             BoundNetLog()));
   waiter1.WaitForStream();
   EXPECT_TRUE(waiter1.stream_done());
-  ASSERT_TRUE(NULL != waiter1.websocket_stream());
+  ASSERT_TRUE(nullptr != waiter1.websocket_stream());
   EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
             waiter1.websocket_stream()->type());
-  EXPECT_TRUE(NULL == waiter1.stream());
+  EXPECT_TRUE(nullptr == waiter1.stream());
 
   EXPECT_EQ(0, GetSocketPoolGroupCount(
       session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
@@ -1154,7 +1156,7 @@
                                        ProxyService::CreateDirect());
 
   MockRead mock_read(SYNCHRONOUS, ERR_IO_PENDING);
-  StaticSocketDataProvider socket_data(&mock_read, 1, NULL, 0);
+  StaticSocketDataProvider socket_data(&mock_read, 1, nullptr, 0);
   socket_data.set_connect_data(MockConnect(ASYNC, OK));
   session_deps.socket_factory->AddSocketDataProvider(&socket_data);
 
@@ -1186,10 +1188,10 @@
                                             BoundNetLog()));
   waiter1.WaitForStream();
   EXPECT_TRUE(waiter1.stream_done());
-  ASSERT_TRUE(NULL != waiter1.websocket_stream());
+  ASSERT_TRUE(nullptr != waiter1.websocket_stream());
   EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy,
             waiter1.websocket_stream()->type());
-  EXPECT_TRUE(NULL == waiter1.stream());
+  EXPECT_TRUE(nullptr == waiter1.stream());
 
   StreamRequestWaiter waiter2;
   scoped_ptr<HttpStreamRequest> request2(
@@ -1203,10 +1205,10 @@
                                             BoundNetLog()));
   waiter2.WaitForStream();
   EXPECT_TRUE(waiter2.stream_done());
-  ASSERT_TRUE(NULL != waiter2.websocket_stream());
+  ASSERT_TRUE(nullptr != waiter2.websocket_stream());
   EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy,
             waiter2.websocket_stream()->type());
-  EXPECT_TRUE(NULL == waiter2.stream());
+  EXPECT_TRUE(nullptr == waiter2.stream());
   EXPECT_NE(waiter2.websocket_stream(), waiter1.websocket_stream());
   EXPECT_EQ(static_cast<WebSocketSpdyHandshakeStream*>(
                 waiter2.websocket_stream())->spdy_session(),
@@ -1232,13 +1234,13 @@
   session_deps.use_alternate_protocols = true;
 
   MockRead mock_read(ASYNC, OK);
-  DeterministicSocketData socket_data(&mock_read, 1, NULL, 0);
+  DeterministicSocketData socket_data(&mock_read, 1, nullptr, 0);
   socket_data.set_connect_data(MockConnect(ASYNC, OK));
   session_deps.deterministic_socket_factory->AddSocketDataProvider(
       &socket_data);
 
   MockRead mock_read2(ASYNC, OK);
-  DeterministicSocketData socket_data2(&mock_read2, 1, NULL, 0);
+  DeterministicSocketData socket_data2(&mock_read2, 1, nullptr, 0);
   socket_data2.set_connect_data(MockConnect(ASYNC, ERR_IO_PENDING));
   session_deps.deterministic_socket_factory->AddSocketDataProvider(
       &socket_data2);
@@ -1278,8 +1280,8 @@
                                             BoundNetLog()));
   waiter.WaitForStream();
   EXPECT_TRUE(waiter.stream_done());
-  EXPECT_TRUE(NULL == waiter.stream());
-  ASSERT_TRUE(NULL != waiter.websocket_stream());
+  EXPECT_TRUE(nullptr == waiter.stream());
+  ASSERT_TRUE(nullptr != waiter.websocket_stream());
   EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy,
             waiter.websocket_stream()->type());