[Reland] Load resources from extension bundles in the network service.

This is a relanding of c67e063843e4bd37522692d9b74586a2304575e5
reviewed at https://chromium-review.googlesource.com/834749 which
broke the Linux CFI builds.

Bug: 782025
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I24e9e3e6dc3312af2a94c4f30232da0f798ab541
Reviewed-on: https://chromium-review.googlesource.com/923565
Commit-Queue: Chris Mumford <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#538274}
diff --git a/chrome/browser/extensions/chrome_url_request_util.h b/chrome/browser/extensions/chrome_url_request_util.h
index ce03bee..3197256 100644
--- a/chrome/browser/extensions/chrome_url_request_util.h
+++ b/chrome/browser/extensions/chrome_url_request_util.h
@@ -8,6 +8,7 @@
 #include <string>
 
 #include "content/public/common/resource_type.h"
+#include "services/network/public/mojom/url_loader.mojom.h"
 #include "ui/base/page_transition_types.h"
 
 class GURL;
@@ -54,6 +55,26 @@
     const std::string& content_security_policy,
     bool send_cors_header);
 
+// Return the |request|'s resource path relative to the Chromium resources path
+// (chrome::DIR_RESOURCES) *if* the request refers to a resource within the
+// Chrome resource bundle. If not then the returned file path will be empty.
+base::FilePath GetBundleResourcePath(
+    const network::ResourceRequest& request,
+    const base::FilePath& extension_resources_path,
+    int* resource_id);
+
+// Creates and starts a URLLoader for loading component extension resources out
+// of a Chrome resource bundle. This should only be called if
+// GetBundleResourcePath returns a valid path.
+void LoadResourceFromResourceBundle(
+    const network::ResourceRequest& request,
+    network::mojom::URLLoaderRequest loader,
+    const base::FilePath& resource_relative_path,
+    int resource_id,
+    const std::string& content_security_policy,
+    network::mojom::URLLoaderClientPtr client,
+    bool send_cors_header);
+
 }  // namespace chrome_url_request_util
 }  // namespace extensions