#include "ui/accessibility/ax_language_detection.h"
#include <algorithm>
#include <functional>
#include <memory>
#include "base/command_line.h"
#include "base/i18n/unicodestring.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/accessibility_switches.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node.h"
#include "ui/accessibility/ax_tree.h"
namespace ui {
namespace {
const int kMaxDetectedLanguagesPerPage = …;
const int kMaxDetectedLanguagesPerSpan = …;
const int kShortTextIdentifierMinByteLength = …;
const int kShortTextIdentifierMaxByteLength = …;
}
Result;
SpanInfo;
AXLanguageInfo::AXLanguageInfo() = default;
AXLanguageInfo::~AXLanguageInfo() = default;
AXLanguageInfoStats::AXLanguageInfoStats()
: … { … }
AXLanguageInfoStats::~AXLanguageInfoStats() = default;
void AXLanguageInfoStats::Add(const std::vector<std::string>& languages) { … }
int AXLanguageInfoStats::GetScore(const std::string& lang) const { … }
void AXLanguageInfoStats::InvalidateTopResults() { … }
bool AXLanguageInfoStats::CheckLanguageWithinTop(const std::string& lang) { … }
void AXLanguageInfoStats::GenerateTopResults() { … }
void AXLanguageInfoStats::RecordLabelStatistics(
const std::string& labelled_lang,
const std::string& author_lang,
bool labelled_with_first_result) { … }
void AXLanguageInfoStats::RecordDetectionAttempt() { … }
void AXLanguageInfoStats::ReportMetrics() { … }
void AXLanguageInfoStats::ClearMetrics() { … }
AXLanguageDetectionManager::AXLanguageDetectionManager(AXTree* tree)
: … { … }
AXLanguageDetectionManager::~AXLanguageDetectionManager() = default;
bool AXLanguageDetectionManager::IsStaticLanguageDetectionEnabled() { … }
bool AXLanguageDetectionManager::IsDynamicLanguageDetectionEnabled() { … }
void AXLanguageDetectionManager::RegisterLanguageDetectionObserver() { … }
void AXLanguageDetectionManager::DetectLanguages() { … }
void AXLanguageDetectionManager::DetectLanguagesForSubtree(
AXNode* subtree_root) { … }
void AXLanguageDetectionManager::DetectLanguagesForNode(AXNode* node) { … }
void AXLanguageDetectionManager::LabelLanguages() { … }
void AXLanguageDetectionManager::LabelLanguagesForSubtree(
AXNode* subtree_root) { … }
void AXLanguageDetectionManager::LabelLanguagesForNode(AXNode* node) { … }
std::vector<AXLanguageSpan>
AXLanguageDetectionManager::GetLanguageAnnotationForStringAttribute(
const AXNode& node,
ax::mojom::StringAttribute attr) { … }
AXLanguageDetectionObserver::AXLanguageDetectionObserver(AXTree* tree)
: … { … }
AXLanguageDetectionObserver::~AXLanguageDetectionObserver() { … }
void AXLanguageDetectionObserver::OnAtomicUpdateFinished(
AXTree* tree,
bool root_changed,
const std::vector<Change>& changes) { … }
}