#include "extensions/browser/api/declarative_webrequest/webrequest_rules_registry.h"
#include <algorithm>
#include <iterator>
#include <limits>
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/declarative_webrequest/webrequest_condition.h"
#include "extensions/browser/api/declarative_webrequest/webrequest_constants.h"
#include "extensions/browser/api/web_request/web_request_api_helpers.h"
#include "extensions/browser/api/web_request/web_request_info.h"
#include "extensions/browser/api/web_request/web_request_permissions.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/permissions/permissions_data.h"
URLMatcherConditionSet;
namespace {
const char kActionCannotBeExecuted[] = …;
const char kAllURLsPermissionNeeded[] = …;
}
namespace extensions {
WebRequestRulesRegistry::WebRequestRulesRegistry(
content::BrowserContext* browser_context,
RulesCacheDelegate* cache_delegate,
int rules_registry_id)
: … { … }
std::set<const WebRequestRule*> WebRequestRulesRegistry::GetMatches(
const WebRequestData& request_data_without_ids) const { … }
std::list<extension_web_request_api_helpers::EventResponseDelta>
WebRequestRulesRegistry::CreateDeltas(PermissionHelper* permission_helper,
const WebRequestData& request_data,
bool crosses_incognito) { … }
std::string WebRequestRulesRegistry::AddRulesImpl(
const ExtensionId& extension_id,
const std::vector<const api::events::Rule*>& rules) { … }
std::string WebRequestRulesRegistry::RemoveRulesImpl(
const ExtensionId& extension_id,
const std::vector<std::string>& rule_identifiers) { … }
std::string WebRequestRulesRegistry::RemoveAllRulesImpl(
const ExtensionId& extension_id) { … }
void WebRequestRulesRegistry::CleanUpAfterRule(
const WebRequestRule* rule,
std::vector<base::MatcherStringPattern::ID>* remove_from_url_matcher) { … }
bool WebRequestRulesRegistry::IsEmpty() const { … }
WebRequestRulesRegistry::~WebRequestRulesRegistry() = default;
base::Time WebRequestRulesRegistry::GetExtensionInstallationTime(
const ExtensionId& extension_id) const { … }
void WebRequestRulesRegistry::ClearCacheOnNavigation() { … }
bool WebRequestRulesRegistry::Checker(const Extension* extension,
const WebRequestConditionSet* conditions,
const WebRequestActionSet* actions,
std::string* error) { … }
bool WebRequestRulesRegistry::HostPermissionsChecker(
const Extension* extension,
const WebRequestActionSet* actions,
std::string* error) { … }
bool WebRequestRulesRegistry::StageChecker(
const WebRequestConditionSet* conditions,
const WebRequestActionSet* actions,
std::string* error) { … }
void WebRequestRulesRegistry::AddTriggeredRules(
const URLMatches& url_matches,
const WebRequestCondition::MatchData& request_data,
RuleSet* result) const { … }
}