#include "components/subresource_filter/content/shared/renderer/web_document_subresource_filter_impl.h"
#include <memory>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/not_fatal_until.h"
#include "base/task/single_thread_task_runner.h"
#include "components/subresource_filter/core/common/load_policy.h"
#include "components/subresource_filter/core/common/memory_mapped_ruleset.h"
#include "components/subresource_filter/core/mojom/subresource_filter.mojom.h"
#include "components/url_pattern_index/proto/rules.pb.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace subresource_filter {
proto;
namespace {
WebLoadPolicy;
proto::ElementType ToElementType(
blink::mojom::RequestContextType request_context) { … }
WebLoadPolicy ToWebLoadPolicy(LoadPolicy load_policy) { … }
void ProxyToTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
base::OnceClosure callback) { … }
}
WebDocumentSubresourceFilterImpl::~WebDocumentSubresourceFilterImpl() = default;
WebDocumentSubresourceFilterImpl::WebDocumentSubresourceFilterImpl(
url::Origin document_origin,
mojom::ActivationState activation_state,
scoped_refptr<const MemoryMappedRuleset> ruleset,
base::OnceClosure first_disallowed_load_callback)
: … { … }
WebLoadPolicy WebDocumentSubresourceFilterImpl::GetLoadPolicy(
const blink::WebURL& resourceUrl,
blink::mojom::RequestContextType request_context) { … }
WebLoadPolicy
WebDocumentSubresourceFilterImpl::GetLoadPolicyForWebSocketConnect(
const blink::WebURL& url) { … }
WebLoadPolicy
WebDocumentSubresourceFilterImpl::GetLoadPolicyForWebTransportConnect(
const blink::WebURL& url) { … }
void WebDocumentSubresourceFilterImpl::ReportDisallowedLoad() { … }
bool WebDocumentSubresourceFilterImpl::ShouldLogToConsole() { … }
WebLoadPolicy WebDocumentSubresourceFilterImpl::getLoadPolicyImpl(
const blink::WebURL& url,
proto::ElementType element_type) { … }
WebDocumentSubresourceFilterImpl::BuilderImpl::BuilderImpl(
url::Origin document_origin,
mojom::ActivationState activation_state,
base::File ruleset_file,
base::OnceClosure first_disallowed_load_callback)
: … { … }
WebDocumentSubresourceFilterImpl::BuilderImpl::~BuilderImpl() { … }
std::unique_ptr<blink::WebDocumentSubresourceFilter>
WebDocumentSubresourceFilterImpl::BuilderImpl::Build() { … }
}