#include "components/subresource_filter/tools/ruleset_converter/rule_stream.h"
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/logging.h"
#include "components/subresource_filter/core/common/unindexed_ruleset.h"
#include "components/subresource_filter/tools/rule_parser/rule.h"
#include "components/subresource_filter/tools/rule_parser/rule_parser.h"
#include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h"
namespace subresource_filter {
namespace {
std::string ReadStreamToString(std::istream* input) { … }
bool IsTrivialParseError(const RuleParser::ParseError& error) { … }
class ProtobufRuleInputStreamImpl { … };
class FilterListRuleInputStream : public RuleInputStream { … };
class FilterListRuleOutputStream : public RuleOutputStream { … };
class ProtobufRuleInputStream : public RuleInputStream { … };
class ProtobufRuleOutputStream : public RuleOutputStream { … };
class UnindexedRulesetRuleInputStream : public RuleInputStream { … };
class UnindexedRulesetRuleOutputStream : public RuleOutputStream { … };
}
std::unique_ptr<RuleInputStream> RuleInputStream::Create(
std::unique_ptr<std::istream> input,
RulesetFormat format) { … }
std::unique_ptr<RuleOutputStream> RuleOutputStream::Create(
std::unique_ptr<std::ostream> output,
RulesetFormat format) { … }
namespace {
constexpr int kChrome54To58ElementTypes = …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
}
bool TransferRules(RuleInputStream* input,
RuleOutputStream* url_rules_output,
RuleOutputStream* css_rules_output,
int chrome_version) { … }
bool DeleteUrlRuleOrAmend(url_pattern_index::proto::UrlRule* rule,
int lowest_chrome_version) { … }
}