blob: 1077ef24207378d0bb88f10fa605ffc98feb7466 [file] [log] [blame]
[email protected]1791e6c92014-04-11 08:29:011// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
lfg048201a2014-09-16 19:09:365#ifndef CHROME_BROWSER_EXTENSIONS_CHROME_URL_REQUEST_UTIL_H_
6#define CHROME_BROWSER_EXTENSIONS_CHROME_URL_REQUEST_UTIL_H_
[email protected]1791e6c92014-04-11 08:29:017
8#include <string>
9
Ken Rockot6414c4d92017-11-08 19:58:3210#include "content/public/common/resource_type.h"
11#include "content/public/common/url_loader.mojom.h"
12#include "ui/base/page_transition_types.h"
13
14class GURL;
15
[email protected]1791e6c92014-04-11 08:29:0116namespace base {
17class FilePath;
18}
19
20namespace net {
21class NetworkDelegate;
22class URLRequest;
23class URLRequestJob;
24}
25
26namespace extensions {
27class Extension;
Ken Rockot6414c4d92017-11-08 19:58:3228class ExtensionSet;
29class ProcessMap;
[email protected]1791e6c92014-04-11 08:29:0130
jamescook8816ae52014-09-05 17:02:3731// Utilities related to URLRequest jobs for extension resources. See
32// chrome/browser/extensions/extension_protocols_unittest.cc for related tests.
lfg048201a2014-09-16 19:09:3633namespace chrome_url_request_util {
[email protected]1791e6c92014-04-11 08:29:0134
lfg048201a2014-09-16 19:09:3635// Sets allowed=true to allow a chrome-extension:// resource request coming from
vivek.vg33f197b2014-09-17 15:26:1836// renderer A to access a resource in an extension running in renderer B.
lfg048201a2014-09-16 19:09:3637// Returns false when it couldn't determine if the resource is allowed or not
Ken Rockot6414c4d92017-11-08 19:58:3238bool AllowCrossRendererResourceLoad(const GURL& url,
39 content::ResourceType resource_type,
40 ui::PageTransition page_transition,
41 int child_id,
lfg3be30332014-09-18 15:47:2642 bool is_incognito,
43 const Extension* extension,
Ken Rockot6414c4d92017-11-08 19:58:3244 const ExtensionSet& extensions,
45 const ProcessMap& process_map,
lfg3be30332014-09-18 15:47:2646 bool* allowed);
[email protected]1791e6c92014-04-11 08:29:0147
48// Creates a URLRequestJob for loading component extension resources out of
49// a Chrome resource bundle. Returns NULL if the requested resource is not a
50// component extension resource.
51net::URLRequestJob* MaybeCreateURLRequestResourceBundleJob(
52 net::URLRequest* request,
53 net::NetworkDelegate* network_delegate,
54 const base::FilePath& directory_path,
55 const std::string& content_security_policy,
56 bool send_cors_header);
57
lfg048201a2014-09-16 19:09:3658} // namespace chrome_url_request_util
[email protected]1791e6c92014-04-11 08:29:0159} // namespace extensions
60
lfg048201a2014-09-16 19:09:3661#endif // CHROME_BROWSER_EXTENSIONS_CHROME_URL_REQUEST_UTIL_H_