#include "chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/not_fatal_until.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/url_matcher/url_matcher_factory.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/api/declarative/declarative_constants.h"
namespace extensions {
namespace {
const char kPageUrlInvalidTypeOfParameter[] = …;
static base::MatcherStringPattern::ID g_next_id = …;
}
DeclarativeContentPageUrlPredicate::~DeclarativeContentPageUrlPredicate() =
default;
std::unique_ptr<DeclarativeContentPageUrlPredicate>
DeclarativeContentPageUrlPredicate::Create(
ContentPredicateEvaluator* evaluator,
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
const base::Value& value,
std::string* error) { … }
ContentPredicateEvaluator*
DeclarativeContentPageUrlPredicate::GetEvaluator() const { … }
DeclarativeContentPageUrlPredicate::DeclarativeContentPageUrlPredicate(
ContentPredicateEvaluator* evaluator,
scoped_refptr<url_matcher::URLMatcherConditionSet>
url_matcher_condition_set)
: … { … }
DeclarativeContentPageUrlConditionTracker::PerWebContentsTracker::
PerWebContentsTracker(content::WebContents* contents,
url_matcher::URLMatcher* url_matcher,
RequestEvaluationCallback request_evaluation,
WebContentsDestroyedCallback web_contents_destroyed)
: … { … }
DeclarativeContentPageUrlConditionTracker::PerWebContentsTracker::
~PerWebContentsTracker() = default;
void DeclarativeContentPageUrlConditionTracker::PerWebContentsTracker::
UpdateMatchesForCurrentUrl(bool request_evaluation_if_unchanged) { … }
void DeclarativeContentPageUrlConditionTracker::PerWebContentsTracker::
WebContentsDestroyed() { … }
DeclarativeContentPageUrlConditionTracker::
DeclarativeContentPageUrlConditionTracker(Delegate* delegate)
: … { … }
DeclarativeContentPageUrlConditionTracker::
~DeclarativeContentPageUrlConditionTracker() = default;
std::string DeclarativeContentPageUrlConditionTracker::
GetPredicateApiAttributeName() const { … }
std::unique_ptr<const ContentPredicate>
DeclarativeContentPageUrlConditionTracker::CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) { … }
void DeclarativeContentPageUrlConditionTracker::TrackPredicates(
const std::map<const void*, std::vector<const ContentPredicate*>>&
predicates) { … }
void DeclarativeContentPageUrlConditionTracker::StopTrackingPredicates(
const std::vector<const void*>& predicate_groups) { … }
void DeclarativeContentPageUrlConditionTracker::TrackForWebContents(
content::WebContents* contents) { … }
void DeclarativeContentPageUrlConditionTracker::OnWebContentsNavigation(
content::WebContents* contents,
content::NavigationHandle* navigation_handle) { … }
void DeclarativeContentPageUrlConditionTracker::OnWatchedPageChanged(
content::WebContents* contents,
const std::vector<std::string>& css_selectors) { … }
bool DeclarativeContentPageUrlConditionTracker::EvaluatePredicate(
const ContentPredicate* predicate,
content::WebContents* tab) const { … }
bool DeclarativeContentPageUrlConditionTracker::IsEmpty() const { … }
void DeclarativeContentPageUrlConditionTracker::DeletePerWebContentsTracker(
content::WebContents* contents) { … }
void DeclarativeContentPageUrlConditionTracker::UpdateMatchesForAllTrackers() { … }
}