#include "ui/accessibility/platform/ax_platform.h"
#include "base/check_op.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/ax_mode_observer.h"
namespace ui {
namespace {
AXPlatform* g_instance = …;
}
AXPlatform& AXPlatform::GetInstance() { … }
AXPlatform::AXPlatform(Delegate& delegate) : … { … }
AXPlatform::~AXPlatform() { … }
void AXPlatform::AddModeObserver(AXModeObserver* observer) { … }
void AXPlatform::RemoveModeObserver(AXModeObserver* observer) { … }
void AXPlatform::NotifyModeAdded(AXMode mode) { … }
bool AXPlatform::IsCaretBrowsingEnabled() { … }
void AXPlatform::SetCaretBrowsingState(bool enabled) { … }
#if BUILDFLAG(IS_WIN)
const std::string& AXPlatform::GetProductName() const {
RetrieveProductStringsIfNeeded();
return product_strings_->product_name;
}
const std::string& AXPlatform::GetProductVersion() const {
RetrieveProductStringsIfNeeded();
return product_strings_->product_version;
}
const std::string& AXPlatform::GetToolkitVersion() const {
RetrieveProductStringsIfNeeded();
return product_strings_->toolkit_version;
}
void AXPlatform::SetUiaProviderEnabled(bool is_enabled) {
CHECK_EQ(uia_provider_enablement_, UiaProviderEnablement::kVariations);
uia_provider_enablement_ = is_enabled ? UiaProviderEnablement::kEnabled
: UiaProviderEnablement::kDisabled;
}
bool AXPlatform::IsUiaProviderEnabled() const {
return uia_provider_enablement_ == UiaProviderEnablement::kVariations
? base::FeatureList::IsEnabled(features::kUiaProvider)
: (uia_provider_enablement_ == UiaProviderEnablement::kEnabled);
}
void AXPlatform::RetrieveProductStringsIfNeeded() const {
if (!product_strings_) {
product_strings_ = delegate_->GetProductStrings();
}
}
#endif
}