#include "extensions/browser/url_loader_factory_manager.h"
#include <utility>
#include <vector>
#include "base/ranges/algorithm.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/process_map.h"
#include "extensions/browser/script_injection_tracker.h"
#include "extensions/common/constants.h"
#include "extensions/common/cors_util.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/common/mojom/host_id.mojom.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/script_constants.h"
#include "extensions/common/url_pattern.h"
#include "extensions/common/url_pattern_set.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"
namespace extensions {
namespace {
enum class FactoryUser { … };
bool DoContentScriptsDependOnRelaxedOrbOrCors(const Extension& extension) { … }
bool DoExtensionPermissionsCoverHttpOrHttpsOrigins(
const PermissionSet& permissions) { … }
bool DoExtensionPermissionsCoverHttpOrHttpsOrigins(const Extension& extension) { … }
bool ShouldRelaxCors(const Extension& extension, FactoryUser factory_user) { … }
bool ShouldCreateSeparateFactoryForContentScripts(const Extension& extension) { … }
void OverrideFactoryParams(const Extension& extension,
FactoryUser factory_user,
network::mojom::URLLoaderFactoryParams* params) { … }
void MarkIsolatedWorldsAsRequiringSeparateURLLoaderFactory(
content::RenderFrameHost* frame,
const std::vector<url::Origin>& request_initiators,
bool push_to_renderer_now) { … }
}
void URLLoaderFactoryManager::WillInjectContentScriptsWhenNavigationCommits(
base::PassKey<ScriptInjectionTracker> pass_key,
content::NavigationHandle* navigation,
const std::vector<const Extension*>& extensions) { … }
void URLLoaderFactoryManager::WillProgrammaticallyInjectContentScript(
base::PassKey<ScriptInjectionTracker> pass_key,
content::RenderFrameHost* frame,
const Extension& extension) { … }
void URLLoaderFactoryManager::OverrideURLLoaderFactoryParams(
content::BrowserContext* browser_context,
const url::Origin& origin,
bool is_for_isolated_world,
network::mojom::URLLoaderFactoryParams* factory_params) { … }
}