#include "third_party/blink/public/common/unique_name/unique_name_helper.h"
#include <algorithm>
#include <string_view>
#include <utility>
#include "base/check_op.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/unguessable_token.h"
#include "crypto/sha2.h"
namespace blink {
namespace {
bool g_preserve_stable_unique_name_for_testing = …;
FrameAdapter;
class PendingChildFrameAdapter : public UniqueNameHelper::FrameAdapter { … };
constexpr char kFramePathPrefix[] = …;
constexpr int kFramePathPrefixLength = …;
constexpr int kFramePathSuffixLength = …;
constexpr char kDynamicFrameMarker[] = …;
constexpr size_t kMaxRequestedNameSize = …;
bool IsNameWithFramePath(std::string_view name) { … }
std::string GenerateCandidate(const FrameAdapter* frame) { … }
std::string GenerateFramePosition(const FrameAdapter* frame) { … }
std::string AppendUniqueSuffix(const FrameAdapter* frame,
const std::string& prefix,
const std::string& likely_unique_suffix) { … }
std::string CalculateNameInternal(const FrameAdapter* frame,
std::string_view name) { … }
std::string CalculateFrameHash(std::string_view name) { … }
std::string CalculateNewName(const FrameAdapter* frame, std::string_view name) { … }
}
UniqueNameHelper::FrameAdapter::~FrameAdapter() { … }
UniqueNameHelper::Replacement::Replacement(std::string old_name,
std::string new_name)
: … { … }
UniqueNameHelper::UniqueNameHelper(FrameAdapter* frame) : … { … }
UniqueNameHelper::~UniqueNameHelper() { … }
std::string UniqueNameHelper::GenerateNameForNewChildFrame(
const std::string& name,
bool is_created_by_script) const { … }
void UniqueNameHelper::UpdateName(const std::string& name) { … }
std::string UniqueNameHelper::UpdateLegacyNameFromV24(
std::string legacy_name,
std::vector<Replacement>* replacements) { … }
std::string UniqueNameHelper::CalculateLegacyNameForTesting(
const FrameAdapter* frame,
const std::string& name) { … }
void UniqueNameHelper::PreserveStableUniqueNameForTesting() { … }
std::string UniqueNameHelper::ExtractStableNameForTesting(
std::string_view unique_name) { … }
}