Load extensions URLs with Network Service enabled
Adds support for chrome-extension:// URLs when the Network Service
is enabled. Navigation and subresource loads are supported, with
access policy mirroring the non-network service path.
Unlike the old code, this loading path does not run on the IO thread
and has no dependencies on IO thread data.
To support this change while reusing significant amounts of core logic,
some extensions code has been refactored to be thread agnostic with
more granular data dependencies (e.g. taking a GURL and ExtensionSet
instead of net::URLRequest and extensions::InfoMap*).
The net result of this change is that we can re-enable ~1220
browser_tests with Network Service enabled.
Bug: 780325
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: I7143c1bf080f40a6f00fc761ed823add951dd61e
Reviewed-on: https://chromium-review.googlesource.com/756660
Commit-Queue: Ken Rockot <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#514915}
diff --git a/extensions/browser/url_request_util.h b/extensions/browser/url_request_util.h
index e3a5eb52..fb831a1bc 100644
--- a/extensions/browser/url_request_util.h
+++ b/extensions/browser/url_request_util.h
@@ -7,15 +7,19 @@
#include <string>
+#include "content/public/common/resource_type.h"
#include "ui/base/page_transition_types.h"
+class GURL;
+
namespace net {
class URLRequest;
}
namespace extensions {
class Extension;
-class InfoMap;
+class ExtensionSet;
+class ProcessMap;
// Utilities related to URLRequest jobs for extension resources. See
// chrome/browser/extensions/extension_protocols_unittest.cc for related tests.
@@ -24,16 +28,16 @@
// Sets allowed=true to allow a chrome-extension:// resource request coming from
// renderer A to access a resource in an extension running in renderer B.
// Returns false when it couldn't determine if the resource is allowed or not
-bool AllowCrossRendererResourceLoad(net::URLRequest* request,
+bool AllowCrossRendererResourceLoad(const GURL& url,
+ content::ResourceType resource_type,
+ ui::PageTransition page_transition,
+ int child_id,
bool is_incognito,
const Extension* extension,
- InfoMap* extension_info_map,
+ const ExtensionSet& extensions,
+ const ProcessMap& process_map,
bool* allowed);
-// Returns true if |request| corresponds to a resource request from a
-// <webview>.
-bool IsWebViewRequest(net::URLRequest* request);
-
// Helper method that is called by both AllowCrossRendererResourceLoad and
// ExtensionNavigationThrottle to share logic.
// Sets allowed=true to allow a chrome-extension:// resource request coming from