blob: fb831a1bc1bcb6e79d4afabafb7d278eaba85aed [file] [log] [blame]
lfg048201a2014-09-16 19:09:361// 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
5#ifndef EXTENSIONS_BROWSER_URL_REQUEST_UTIL_H_
6#define EXTENSIONS_BROWSER_URL_REQUEST_UTIL_H_
7
jam6adb8c22016-10-13 17:14:278#include <string>
9
Ken Rockot6414c4d92017-11-08 19:58:3210#include "content/public/common/resource_type.h"
jam6adb8c22016-10-13 17:14:2711#include "ui/base/page_transition_types.h"
12
Ken Rockot6414c4d92017-11-08 19:58:3213class GURL;
14
lfg048201a2014-09-16 19:09:3615namespace net {
16class URLRequest;
17}
18
19namespace extensions {
20class Extension;
Ken Rockot6414c4d92017-11-08 19:58:3221class ExtensionSet;
22class ProcessMap;
lfg048201a2014-09-16 19:09:3623
24// Utilities related to URLRequest jobs for extension resources. See
25// chrome/browser/extensions/extension_protocols_unittest.cc for related tests.
26namespace url_request_util {
27
28// Sets allowed=true to allow a chrome-extension:// resource request coming from
vivek.vg33f197b2014-09-17 15:26:1829// renderer A to access a resource in an extension running in renderer B.
lfg048201a2014-09-16 19:09:3630// Returns false when it couldn't determine if the resource is allowed or not
Ken Rockot6414c4d92017-11-08 19:58:3231bool AllowCrossRendererResourceLoad(const GURL& url,
32 content::ResourceType resource_type,
33 ui::PageTransition page_transition,
34 int child_id,
lfg048201a2014-09-16 19:09:3635 bool is_incognito,
36 const Extension* extension,
Ken Rockot6414c4d92017-11-08 19:58:3237 const ExtensionSet& extensions,
38 const ProcessMap& process_map,
lfg048201a2014-09-16 19:09:3639 bool* allowed);
40
jam6adb8c22016-10-13 17:14:2741// Helper method that is called by both AllowCrossRendererResourceLoad and
42// ExtensionNavigationThrottle to share logic.
43// Sets allowed=true to allow a chrome-extension:// resource request coming from
44// renderer A to access a resource in an extension running in renderer B.
45// Returns false when it couldn't determine if the resource is allowed or not
46bool AllowCrossRendererResourceLoadHelper(bool is_guest,
47 const Extension* extension,
48 const Extension* owner_extension,
49 const std::string& partition_id,
50 const std::string& resource_path,
51 ui::PageTransition page_transition,
52 bool* allowed);
53
lfg048201a2014-09-16 19:09:3654} // namespace url_request_util
55} // namespace extensions
56
57#endif // EXTENSIONS_BROWSER_URL_REQUEST_UTIL_H_