Remove ability for a URLRequest to use a separate NetworkDelegate.

The URLRequest constructor could accept a NetworkDelegate argument
which would override the URLRequestContext's NetworkDelegate. However,
URLRequest's constructor was private, and only URLRequestContext could
call it, and URLRequestContext didn't have a method to pass a
NetworkDelegate other than its own to URLRequest's constructor. As a
result, not only was nothing taking advantage of this ability, but
nothing *could* take advantage of it.

To the extent of my knowledge, this ability has never been used, yet
the per-request NetworkDelegate argument was wired through the entire
URLRequestJob creation stack.

Since this CL is already touching all URLRequestInterceptors, it
also updates the URLRequestInterceptor API to return a unique_ptr.

TBR= [email protected]

Bug: 1126597
Change-Id: I5f0fade639e06a2edc8f514853262af3afa6e110
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401854
Reviewed-by: Matt Menke <[email protected]>
Reviewed-by: Monica Basta <[email protected]>
Reviewed-by: Eugene But <[email protected]>
Reviewed-by: Eric Roman <[email protected]>
Commit-Queue: Matt Menke <[email protected]>
Cr-Commit-Position: refs/heads/master@{#807048}
diff --git a/net/url_request/url_request_interceptor.h b/net/url_request/url_request_interceptor.h
index 9ed1670..0ce071f 100644
--- a/net/url_request/url_request_interceptor.h
+++ b/net/url_request/url_request_interceptor.h
@@ -5,6 +5,8 @@
 #ifndef NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_
 #define NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "net/base/net_export.h"
 
@@ -12,7 +14,6 @@
 
 class URLRequest;
 class URLRequestJob;
-class NetworkDelegate;
 
 // In tests, URLRequestFilter lets URLRequestInterceptors create URLRequestJobs
 // to handle URLRequests before they're handed off to the ProtocolHandler for
@@ -27,9 +28,9 @@
 
   // Returns a URLRequestJob to handle |request|, if the interceptor wants to
   // take over the handling the request instead of the default ProtocolHandler.
-  // Otherwise, returns NULL.
-  virtual URLRequestJob* MaybeInterceptRequest(
-      URLRequest* request, NetworkDelegate* network_delegate) const = 0;
+  // Otherwise, returns nullptr.
+  virtual std::unique_ptr<URLRequestJob> MaybeInterceptRequest(
+      URLRequest* request) const = 0;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(URLRequestInterceptor);