#include "chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h"
#include <stddef.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 "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/common/api/declarative/declarative_constants.h"
#include "extensions/common/mojom/renderer.mojom.h"
namespace extensions {
namespace {
const char kCssInvalidTypeOfParameter[] = …;
}
DeclarativeContentCssPredicate::~DeclarativeContentCssPredicate() = default;
std::unique_ptr<DeclarativeContentCssPredicate>
DeclarativeContentCssPredicate::Create(ContentPredicateEvaluator* evaluator,
const base::Value& value,
std::string* error) { … }
ContentPredicateEvaluator*
DeclarativeContentCssPredicate::GetEvaluator() const { … }
DeclarativeContentCssPredicate::DeclarativeContentCssPredicate(
ContentPredicateEvaluator* evaluator,
const std::vector<std::string>& css_selectors)
: … { … }
DeclarativeContentCssConditionTracker::PerWebContentsTracker::
PerWebContentsTracker(content::WebContents* contents,
RequestEvaluationCallback request_evaluation,
WebContentsDestroyedCallback web_contents_destroyed)
: … { … }
DeclarativeContentCssConditionTracker::PerWebContentsTracker::
~PerWebContentsTracker() = default;
void DeclarativeContentCssConditionTracker::PerWebContentsTracker::
OnWebContentsNavigation(content::NavigationHandle* navigation_handle) { … }
void DeclarativeContentCssConditionTracker::PerWebContentsTracker::
OnWatchedPageChanged(const std::vector<std::string>& css_selectors) { … }
void DeclarativeContentCssConditionTracker::PerWebContentsTracker::
WebContentsDestroyed() { … }
DeclarativeContentCssConditionTracker::DeclarativeContentCssConditionTracker(
Delegate* delegate)
: … { … }
DeclarativeContentCssConditionTracker::
~DeclarativeContentCssConditionTracker() = default;
std::string DeclarativeContentCssConditionTracker::
GetPredicateApiAttributeName() const { … }
std::unique_ptr<const ContentPredicate>
DeclarativeContentCssConditionTracker::CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) { … }
void DeclarativeContentCssConditionTracker::TrackPredicates(
const std::map<const void*, std::vector<const ContentPredicate*>>&
predicates) { … }
void DeclarativeContentCssConditionTracker::StopTrackingPredicates(
const std::vector<const void*>& predicate_groups) { … }
void DeclarativeContentCssConditionTracker::TrackForWebContents(
content::WebContents* contents) { … }
void DeclarativeContentCssConditionTracker::OnWebContentsNavigation(
content::WebContents* contents,
content::NavigationHandle* navigation_handle) { … }
void DeclarativeContentCssConditionTracker::OnWatchedPageChanged(
content::WebContents* contents,
const std::vector<std::string>& css_selectors) { … }
bool DeclarativeContentCssConditionTracker::EvaluatePredicate(
const ContentPredicate* predicate,
content::WebContents* tab) const { … }
void DeclarativeContentCssConditionTracker::OnRenderProcessHostCreated(
content::RenderProcessHost* host) { … }
void DeclarativeContentCssConditionTracker::
UpdateRenderersWatchedCssSelectors(
const std::vector<std::string>& watched_css_selectors) { … }
std::vector<std::string> DeclarativeContentCssConditionTracker::
GetWatchedCssSelectors() const { … }
void DeclarativeContentCssConditionTracker::
InstructRenderProcessIfManagingBrowserContext(
content::RenderProcessHost* process,
std::vector<std::string> watched_css_selectors) { … }
void DeclarativeContentCssConditionTracker::DeletePerWebContentsTracker(
content::WebContents* contents) { … }
}