Convert URLLoaderFactoryBundle to implement SharedURLLoaderFactory interface.

This CL also typemaps content.mojom.URLLoaderFactoryBundle to
std::unique_ptr<content::URLLoaderFactoryBundleInfo>.

This is part of the effort to avoid using raw mojom::URLLoaderFactory pointers
in renderers and also unify interface of URLLoaderFactory getters.

Bug: 796425
Change-Id: Ia30cd253ec0c82624fbf466a70da489e4464b82f
Reviewed-on: https://chromium-review.googlesource.com/877390
Commit-Queue: Yuzhu Shen <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#531318}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 721c0d5b..7097b46 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -527,7 +527,7 @@
       const CommonNavigationParams& common_params,
       const RequestNavigationParams& request_params,
       network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
-      base::Optional<URLLoaderFactoryBundle> subresource_loaders,
+      std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders,
       mojom::ControllerServiceWorkerInfoPtr controller_service_worker_info,
       const base::UnguessableToken& devtools_navigation_token) override;
   void CommitFailedNavigation(
@@ -536,7 +536,7 @@
       bool has_stale_copy_in_cache,
       int error_code,
       const base::Optional<std::string>& error_page_content,
-      base::Optional<URLLoaderFactoryBundle> subresource_loaders) override;
+      std::unique_ptr<URLLoaderFactoryBundleInfo> subresource_loaders) override;
 
   // mojom::FullscreenVideoElementHandler implementation:
   void RequestFullscreenVideoElement() override;
@@ -1116,7 +1116,7 @@
   // browser at navigation time. For any other frames (i.e. frames on the
   // initial about:blank Document), the bundle returned here is lazily cloned
   // from the parent or opener's own bundle.
-  URLLoaderFactoryBundle& GetSubresourceLoaderFactories();
+  URLLoaderFactoryBundle* GetSubresourceLoaderFactories();
 
   // Update current main frame's encoding and send it to browser window.
   // Since we want to let users see the right encoding info from menu
@@ -1607,7 +1607,7 @@
 
   // URLLoaderFactory instances used for subresource loading when the Network
   // Service is enabled.
-  base::Optional<URLLoaderFactoryBundle> subresource_loader_factories_;
+  scoped_refptr<URLLoaderFactoryBundle> subresource_loader_factories_;
 
   // AndroidOverlay routing token from the browser, if we have one yet.
   base::Optional<base::UnguessableToken> overlay_routing_token_;