#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/url_formatter/spoof_checks/skeleton_generator.h"
#include <ostream>
#include <queue>
#include <string_view>
#include "base/i18n/unicodestring.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "third_party/icu/source/i18n/unicode/regex.h"
#include "third_party/icu/source/i18n/unicode/translit.h"
#include "third_party/icu/source/i18n/unicode/uspoof.h"
namespace {
QueueItem;
const size_t kMaxHostnameLengthToComputeSupplementalHostnames = …;
const size_t kMaxSupplementalHostnames = …;
const size_t kMaxCharactersWithMultipleSkeletons = …;
const size_t kMaxSupplementalSkeletonsPerCharacter = …;
}
SkeletonGenerator::SkeletonGenerator(const USpoofChecker* checker)
: … { … }
SkeletonGenerator::~SkeletonGenerator() = default;
void SkeletonGenerator::MaybeRemoveDiacritics(icu::UnicodeString& hostname) { … }
std::u16string SkeletonGenerator::MaybeRemoveDiacritics(
std::u16string_view hostname) { … }
bool SkeletonGenerator::ShouldComputeSupplementalHostnamesWithDiacritics(
std::u16string_view input_hostname) const { … }
Skeletons SkeletonGenerator::GetSkeletons(std::u16string_view input_hostname) { … }
bool SkeletonGenerator::ShouldRemoveDiacriticsFromLabel(
const icu::UnicodeString& label) const { … }
void SkeletonGenerator::AddSkeletonMapping(const icu::UnicodeString& host,
int32_t src_char,
int32_t mapped_char,
Skeletons* skeletons) { … }
base::flat_set<std::u16string> SkeletonGenerator::GenerateSupplementalHostnames(
std::u16string_view input,
size_t max_alternatives,
const SkeletonMap& mapping) { … }