blob: bd6ca8f56aaed6e4f8d22360b4ec91db517b24f6 [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/accessibility/platform/uia_registrar_win.h"
#include <wrl/implements.h>
#include "base/stl_util.h"
namespace ui {
UiaRegistrarWin::UiaRegistrarWin() {
// Create the registrar object and get the IUIAutomationRegistrar
// interface pointer.
Microsoft::WRL::ComPtr<IUIAutomationRegistrar> registrar;
if (FAILED(CoCreateInstance(CLSID_CUIAutomationRegistrar, nullptr,
// Register the custom UIA property that represents the unique id of an UIA
// element which also matches its corresponding IA2 element's unique id.
UIAutomationPropertyInfo unique_id_property_info = {
kUiaPropertyUniqueIdGuid, L"UniqueId", UIAutomationType_String};
// Register the custom UIA event that represents the test end event for the
// UIA test suite.
UIAutomationEventInfo test_complete_event_info = {
kUiaEventTestCompleteSentinelGuid, L"kUiaTestCompleteSentinel"};
UiaRegistrarWin::~UiaRegistrarWin() = default;
PROPERTYID UiaRegistrarWin::GetUiaUniqueIdPropertyId() const {
return uia_unique_id_property_id_;
EVENTID UiaRegistrarWin::GetUiaTestCompleteEventId() const {
return uia_test_complete_event_id_;
const UiaRegistrarWin& UiaRegistrarWin::GetInstance() {
static base::NoDestructor<UiaRegistrarWin> instance;
return *instance;
} // namespace ui