Add NetworkService support for extensions and downloads (see issue #2622).

To test:
- All tests pass with NetworkService disabled. DownloadTest.*, ExtensionTest.*
  and PluginTest.* tests pass with NetworkService enabled.
- The PDF extension displays a file, and the download and print buttons work.
This commit is contained in:
Marshall Greenblatt
2019-05-01 15:09:59 -04:00
parent 0193a3fe54
commit 5ce52bd775
10 changed files with 181 additions and 37 deletions

View File

@@ -122,20 +122,22 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
base::FilePath CefExtensionsBrowserClient::GetBundleResourcePath(
const network::ResourceRequest& request,
const base::FilePath& extension_resources_path,
ComponentExtensionResourceInfo* resource_id) const {
*resource_id = {0};
return base::FilePath();
ComponentExtensionResourceInfo* resource_info) const {
return chrome_url_request_util::GetBundleResourcePath(
request, extension_resources_path, resource_info);
}
void CefExtensionsBrowserClient::LoadResourceFromResourceBundle(
const network::ResourceRequest& request,
network::mojom::URLLoaderRequest loader,
const base::FilePath& resource_relative_path,
const ComponentExtensionResourceInfo& resource_id,
const ComponentExtensionResourceInfo& resource_info,
const std::string& content_security_policy,
network::mojom::URLLoaderClientPtr client,
bool send_cors_header) {
NOTREACHED() << "Load resources from bundles not supported.";
chrome_url_request_util::LoadResourceFromResourceBundle(
request, std::move(loader), resource_relative_path, resource_info,
content_security_policy, std::move(client), send_cors_header);
}
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
@@ -147,13 +149,6 @@ bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
const Extension* extension,
const ExtensionSet& extensions,
const ProcessMap& process_map) {
// TODO(cef): This bypasses additional checks added to
// AllowCrossRendererResourceLoad() in https://crrev.com/5cf9d45c. Figure out
// why permission is not being granted based on "web_accessible_resources"
// specified in the PDF extension manifest.json file.
if (extension && extension->id() == extension_misc::kPdfExtensionId)
return true;
bool allowed = false;
if (url_request_util::AllowCrossRendererResourceLoad(
url, resource_type, page_transition, child_id, is_incognito,