#include "extensions/browser/api/declarative_net_request/request_params.h"
#include <algorithm>
#include <string_view>
#include "base/check.h"
#include "base/containers/flat_map.h"
#include "base/dcheck_is_on.h"
#include "base/functional/bind.h"
#include "base/no_destructor.h"
#include "base/ranges/algorithm.h"
#include "base/strings/pattern.h"
#include "base/strings/string_util.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/api/declarative_net_request/constants.h"
#include "extensions/browser/api/declarative_net_request/flat/extension_ruleset_generated.h"
#include "extensions/browser/api/declarative_net_request/utils.h"
#include "extensions/browser/api/web_request/web_request_info.h"
#include "extensions/browser/api/web_request/web_request_resource_type.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/constants.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/http/http_response_headers.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "url/gurl.h"
namespace extensions::declarative_net_request {
namespace {
flat_rule;
bool IsThirdPartyRequest(const GURL& url, const url::Origin& document_origin) { … }
bool IsThirdPartyRequest(const url::Origin& origin,
const url::Origin& document_origin) { … }
content::GlobalRenderFrameHostId GetFrameRoutingId(
content::RenderFrameHost* host) { … }
bool HasHeaderValue(const net::HttpResponseHeaders& response_headers,
std::string_view header,
const flatbuffers::String* flat_pattern) { … }
bool MatchesHeaderConditions(
const net::HttpResponseHeaders& response_headers,
const flatbuffers::Vector<flatbuffers::Offset<flat::HeaderCondition>>&
header_conditions) { … }
bool DoEmbedderConditionsMatch(
int tab_id,
scoped_refptr<const net::HttpResponseHeaders> response_headers,
const flatbuffers::Vector<uint8_t>& conditions_buffer) { … }
}
RequestParams::RequestParams(
const WebRequestInfo& info,
scoped_refptr<const net::HttpResponseHeaders> response_headers)
: … { … }
RequestParams::RequestParams(
content::RenderFrameHost* host,
bool is_post_navigation,
scoped_refptr<const net::HttpResponseHeaders> response_headers)
: … { … }
RequestParams::RequestParams(
const GURL& url,
const url::Origin& initiator,
const api::declarative_net_request::ResourceType request_type,
const api::declarative_net_request::RequestMethod request_method,
int tab_id,
scoped_refptr<const net::HttpResponseHeaders> response_headers)
: … { … }
RequestParams::RequestParams() = default;
RequestParams::~RequestParams() = default;
}