#include "components/subresource_filter/core/browser/async_document_subresource_filter.h"
#include <utility>
#include "base/check.h"
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/not_fatal_until.h"
#include "components/subresource_filter/core/browser/verified_ruleset_dealer.h"
#include "components/subresource_filter/core/common/document_subresource_filter.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 "url/gurl.h"
#include "url/origin.h"
namespace subresource_filter {
mojom::ActivationState ComputeActivationState(
const GURL& document_url,
const url::Origin& parent_document_origin,
const mojom::ActivationState& parent_activation_state,
const MemoryMappedRuleset* ruleset) { … }
InitializationParams;
InitializationParams::InitializationParams() = default;
InitializationParams::InitializationParams(
GURL document_url,
mojom::ActivationLevel activation_level,
bool measure_performance)
: … { … }
InitializationParams::InitializationParams(
GURL document_url,
url::Origin parent_document_origin,
mojom::ActivationState parent_activation_state)
: … { … }
InitializationParams::~InitializationParams() = default;
InitializationParams::InitializationParams(InitializationParams&&) = default;
InitializationParams& InitializationParams::operator=(InitializationParams&&) =
default;
AsyncDocumentSubresourceFilter::AsyncDocumentSubresourceFilter(
VerifiedRuleset::Handle* ruleset_handle,
InitializationParams params,
base::OnceCallback<void(mojom::ActivationState)> activation_state_callback)
: … { … }
AsyncDocumentSubresourceFilter::AsyncDocumentSubresourceFilter(
VerifiedRuleset::Handle* ruleset_handle,
const url::Origin& inherited_document_origin,
const mojom::ActivationState& activation_state)
: … { … }
AsyncDocumentSubresourceFilter::~AsyncDocumentSubresourceFilter() { … }
void AsyncDocumentSubresourceFilter::OnActivateStateCalculated(
base::OnceCallback<void(mojom::ActivationState)> activation_state_callback,
mojom::ActivationState activation_state) { … }
void AsyncDocumentSubresourceFilter::GetLoadPolicyForSubdocument(
const GURL& subdocument_url,
LoadPolicyCallback result_callback) { … }
void AsyncDocumentSubresourceFilter::GetLoadPolicyForSubdocumentURLs(
const std::vector<GURL>& urls,
MultiLoadPolicyCallback result_callback) { … }
void AsyncDocumentSubresourceFilter::ReportDisallowedLoad() { … }
void AsyncDocumentSubresourceFilter::UpdateWithMoreAccurateState(
const mojom::ActivationState& updated_page_state) { … }
const mojom::ActivationState& AsyncDocumentSubresourceFilter::activation_state()
const { … }
AsyncDocumentSubresourceFilter::Core::Core() { … }
AsyncDocumentSubresourceFilter::Core::~Core() { … }
std::vector<LoadPolicy> AsyncDocumentSubresourceFilter::Core::GetLoadPolicies(
const std::vector<GURL>& urls) { … }
void AsyncDocumentSubresourceFilter::Core::SetActivationState(
const mojom::ActivationState& state) { … }
mojom::ActivationState AsyncDocumentSubresourceFilter::Core::Initialize(
InitializationParams params,
VerifiedRuleset* verified_ruleset) { … }
void AsyncDocumentSubresourceFilter::Core::InitializeWithActivation(
mojom::ActivationState activation_state,
const url::Origin& inherited_document_origin,
VerifiedRuleset* verified_ruleset) { … }
}