#include "chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/api/declarative/rules_registry_service.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/api/declarative/declarative_constants.h"
#include "extensions/common/extension_id.h"
namespace extensions {
class ChromeContentRulesRegistry::EvaluationScope { … };
ChromeContentRulesRegistry::EvaluationScope::EvaluationScope(
ChromeContentRulesRegistry* registry)
: … { … }
ChromeContentRulesRegistry::EvaluationScope::EvaluationScope(
ChromeContentRulesRegistry* registry,
EvaluationDisposition disposition)
: … { … }
ChromeContentRulesRegistry::EvaluationScope::~EvaluationScope() { … }
ChromeContentRulesRegistry::ChromeContentRulesRegistry(
content::BrowserContext* browser_context,
RulesCacheDelegate* cache_delegate,
PredicateEvaluatorsFactory evaluators_factory)
: … { … }
void ChromeContentRulesRegistry::RequestEvaluation(
content::WebContents* contents) { … }
bool ChromeContentRulesRegistry::ShouldManageConditionsForBrowserContext(
content::BrowserContext* context) { … }
void ChromeContentRulesRegistry::MonitorWebContentsForRuleEvaluation(
content::WebContents* contents) { … }
void ChromeContentRulesRegistry::DidFinishNavigation(
content::WebContents* contents,
content::NavigationHandle* navigation_handle) { … }
void ChromeContentRulesRegistry::WebContentsDestroyed(
content::WebContents* web_contents) { … }
void ChromeContentRulesRegistry::OnWatchedPageChanged(
content::WebContents* contents,
const std::vector<std::string>& css_selectors) { … }
ChromeContentRulesRegistry::ContentRule::ContentRule(
const Extension* extension,
std::vector<std::unique_ptr<const ContentCondition>> conditions,
std::vector<std::unique_ptr<const ContentAction>> actions,
int priority)
: … { … }
ChromeContentRulesRegistry::ContentRule::~ContentRule() { … }
std::unique_ptr<const ChromeContentRulesRegistry::ContentRule>
ChromeContentRulesRegistry::CreateRule(
const Extension* extension,
const std::map<std::string, ContentPredicateFactory*>& predicate_factories,
const api::events::Rule& api_rule,
std::string* error) { … }
bool ChromeContentRulesRegistry::ManagingRulesForBrowserContext(
content::BrowserContext* context) { … }
bool ChromeContentRulesRegistry::EvaluateConditionForTab(
const ContentCondition* condition,
content::WebContents* tab) { … }
std::set<
raw_ptr<const ChromeContentRulesRegistry::ContentRule, SetExperimental>>
ChromeContentRulesRegistry::GetMatchingRules(content::WebContents* tab) const { … }
std::string ChromeContentRulesRegistry::AddRulesImpl(
const ExtensionId& extension_id,
const std::vector<const api::events::Rule*>& api_rules) { … }
std::string ChromeContentRulesRegistry::RemoveRulesImpl(
const ExtensionId& extension_id,
const std::vector<std::string>& rule_identifiers) { … }
std::string ChromeContentRulesRegistry::RemoveAllRulesImpl(
const ExtensionId& extension_id) { … }
void ChromeContentRulesRegistry::EvaluateConditionsForTab(
content::WebContents* tab) { … }
bool
ChromeContentRulesRegistry::ShouldEvaluateExtensionRulesForIncognitoRenderer(
const Extension* extension) const { … }
size_t ChromeContentRulesRegistry::GetActiveRulesCountForTesting() { … }
ChromeContentRulesRegistry::~ChromeContentRulesRegistry() { … }
}