#include "extensions/browser/api/declarative_net_request/install_index_helper.h"
#include <iterator>
#include <utility>
#include "base/barrier_closure.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "extensions/browser/api/declarative_net_request/constants.h"
#include "extensions/browser/api/declarative_net_request/utils.h"
#include "extensions/browser/ruleset_parse_result.h"
#include "extensions/common/api/declarative_net_request.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
namespace extensions::declarative_net_request {
namespace {
dnr_api;
constexpr char kDNRIgnoreRulesetKey[] = …;
constexpr char kDNRChecksumKey[] = …;
base::Value::Dict ConvertRulesetToDict(bool ignored,
std::optional<int> checksum) { … }
void SetRulesetDict(base::Value::Dict& dict,
RulesetID id,
base::Value::Dict ruleset) { … }
RulesetParseResult CombineResults(
std::vector<std::pair<const FileBackedRulesetSource*,
IndexAndPersistJSONRulesetResult>> results,
bool log_histograms) { … }
}
void InstallIndexHelper::IndexStaticRulesets(
const Extension& extension,
FileBackedRulesetSource::RulesetFilter ruleset_filter,
uint8_t parse_flags,
IndexCallback callback) { … }
RulesetParseResult InstallIndexHelper::IndexStaticRulesetsUnsafe(
const Extension& extension,
FileBackedRulesetSource::RulesetFilter ruleset_filter,
uint8_t parse_flags) { … }
InstallIndexHelper::InstallIndexHelper(
std::vector<FileBackedRulesetSource> sources,
IndexCallback callback)
: … { … }
InstallIndexHelper::~InstallIndexHelper() = default;
void InstallIndexHelper::Start(uint8_t parse_flags) { … }
void InstallIndexHelper::OnAllRulesetsIndexed() { … }
void InstallIndexHelper::OnRulesetIndexed(
base::OnceClosure ruleset_done_closure,
size_t source_index,
IndexAndPersistJSONRulesetResult result) { … }
}