#include "ui/accessibility/platform/automation/automation_tree_manager_owner.h"
#include <map>
#include <set>
#include "base/containers/flat_tree.h"
#include "base/i18n/string_search.h"
#include "ui/accessibility/ax_enum_util.h"
#include "ui/accessibility/ax_enums.mojom-shared.h"
#include "ui/accessibility/ax_event.h"
#include "ui/accessibility/ax_event_generator.h"
#include "ui/accessibility/ax_node_position.h"
#include "ui/accessibility/ax_position.h"
#include "ui/accessibility/ax_range.h"
#include "ui/accessibility/ax_text_utils.h"
#include "ui/accessibility/platform/automation/automation_api_util.h"
#include "ui/accessibility/platform/automation/automation_ax_tree_wrapper.h"
#include "ui/accessibility/platform/automation/automation_v8_bindings.h"
#include "ui/gfx/geometry/rect_conversions.h"
namespace ui {
AutomationTreeManagerOwner::AutomationTreeManagerOwner() : … { … }
AutomationTreeManagerOwner::~AutomationTreeManagerOwner() = default;
void AutomationTreeManagerOwner::SendNodesRemovedEvent(
AXTree* tree,
const std::vector<int>& ids) { … }
bool AutomationTreeManagerOwner::SendTreeChangeEvent(
ax::mojom::Mutation change_type,
AXTree* tree,
AXNode* node) { … }
void AutomationTreeManagerOwner::SendAutomationEvent(
AXTreeID tree_id,
const gfx::Point& mouse_location,
const AXEvent& event,
std::optional<AXEventGenerator::Event> generated_event_type) { … }
AXNode* AutomationTreeManagerOwner::GetHostInParentTree(
AutomationAXTreeWrapper** in_out_tree_wrapper) const { … }
AutomationAXTreeWrapper*
AutomationTreeManagerOwner::GetAutomationAXTreeWrapperFromTreeID(
AXTreeID tree_id) const { … }
AXNode* AutomationTreeManagerOwner::GetParent(
AXNode* node,
AutomationAXTreeWrapper** in_out_tree_wrapper,
bool should_use_app_id,
bool requires_unignored) const { … }
void AutomationTreeManagerOwner::MaybeSendFocusAndBlur(
AutomationAXTreeWrapper* tree,
const AXTreeID& tree_id,
const std::vector<AXTreeUpdate>& updates,
const std::vector<AXEvent>& events,
gfx::Point mouse_location) { … }
std::optional<gfx::Rect>
AutomationTreeManagerOwner::GetAccessibilityFocusedLocation() const { … }
void AutomationTreeManagerOwner::SendAccessibilityFocusedLocationChange(
const gfx::Point& mouse_location) { … }
bool AutomationTreeManagerOwner::GetFocusInternal(
AutomationAXTreeWrapper* tree_wrapper,
AutomationAXTreeWrapper** out_tree_wrapper,
AXNode** out_node) const { … }
gfx::Rect AutomationTreeManagerOwner::ComputeGlobalNodeBounds(
AutomationAXTreeWrapper* tree_wrapper,
AXNode* node,
gfx::RectF local_bounds,
bool* offscreen,
bool clip_bounds) const { … }
std::vector<AXNode*> AutomationTreeManagerOwner::GetRootsOfChildTree(
AXNode* node) const { … }
AXNode* AutomationTreeManagerOwner::GetNextInTreeOrder(
AXNode* start,
AutomationAXTreeWrapper** in_out_tree_wrapper) const { … }
AXNode* AutomationTreeManagerOwner::GetPreviousInTreeOrder(
AXNode* start,
AutomationAXTreeWrapper** in_out_tree_wrapper) const { … }
std::vector<int> AutomationTreeManagerOwner::CalculateSentenceBoundary(
AutomationAXTreeWrapper* tree_wrapper,
AXNode* node,
bool start_boundary) { … }
bool AutomationTreeManagerOwner::GetFocus(AXTreeID* focused_tree_id,
int* node_id) const { … }
size_t AutomationTreeManagerOwner::GetChildCount(AXNode* node) const { … }
std::vector<int> AutomationTreeManagerOwner::GetChildIDs(
AXNode* node,
AXTreeID* result_tree_id) const { … }
bool AutomationTreeManagerOwner::GetBoundsForRange(
AutomationAXTreeWrapper* tree_wrapper,
AXNode* node,
int start,
int end,
bool clipped,
gfx::Rect* result) const { … }
const char* AutomationTreeManagerOwner::GetName(AXNode* node) const { … }
bool AutomationTreeManagerOwner::GetNextTextMatch(
AutomationAXTreeWrapper* tree_wrapper,
AXNode* node,
const std::string& search_str,
bool backward,
AXTreeID* result_tree_id,
int* result_node_id) const { … }
bool AutomationTreeManagerOwner::GetChildIDAtIndex(const AXTreeID& tree_id,
int node_id,
int index,
AXTreeID* child_tree_id,
int* child_node_id) const { … }
bool AutomationTreeManagerOwner::GetAccessibilityFocus(AXTreeID* tree_id,
int* node_id) const { … }
AXNode* AutomationTreeManagerOwner::GetNodeFromTree(const AXTreeID& tree_id,
int node_id) const { … }
void AutomationTreeManagerOwner::AddTreeChangeObserver(
int observer_id,
TreeChangeObserverFilter filter) { … }
void AutomationTreeManagerOwner::RemoveTreeChangeObserver(int observer_id) { … }
bool AutomationTreeManagerOwner::ShouldSendTreeChangeEvent(
ax::mojom::Mutation change_type,
AXTree* tree,
AXNode* node) const { … }
void AutomationTreeManagerOwner::DestroyAccessibilityTree(
const AXTreeID& tree_id) { … }
bool AutomationTreeManagerOwner::CalculateNodeState(const AXTreeID& tree_id,
int node_id,
uint32_t* node_state,
bool* offscreen,
bool* focused) const { … }
void AutomationTreeManagerOwner::SetAccessibilityFocus(AXTreeID tree_id) { … }
void AutomationTreeManagerOwner::CacheAutomationTreeWrapperForTreeID(
const AXTreeID& tree_id,
AutomationAXTreeWrapper* tree_wrapper) { … }
void AutomationTreeManagerOwner::RemoveAutomationTreeWrapperFromCache(
const AXTreeID& tree_id) { … }
void AutomationTreeManagerOwner::ClearCachedAutomationTreeWrappers() { … }
void AutomationTreeManagerOwner::ClearCachedAccessibilityTrees() { … }
void AutomationTreeManagerOwner::Invalidate() { … }
void AutomationTreeManagerOwner::TreeEventListenersChanged(
AutomationAXTreeWrapper* tree_wrapper) { … }
bool AutomationTreeManagerOwner::HasTreesWithEventListeners() const { … }
void AutomationTreeManagerOwner::
MaybeSendOnAllAutomationEventListenersRemoved() { … }
void AutomationTreeManagerOwner::UpdateOverallTreeChangeObserverFilter() { … }
void AutomationTreeManagerOwner::DispatchTreeDestroyedEvent(
const AXTreeID& tree_id) { … }
void AutomationTreeManagerOwner::DispatchAccessibilityEvents(
const AXTreeID& tree_id,
const std::vector<AXTreeUpdate>& updates,
const gfx::Point& mouse_location,
const std::vector<AXEvent>& events) { … }
void AutomationTreeManagerOwner::DispatchAccessibilityLocationChange(
const AXTreeID& tree_id,
int32_t node_id,
const AXRelativeBounds& bounds) { … }
void AutomationTreeManagerOwner::DispatchActionResult(const AXActionData& data,
bool result) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void AutomationTreeManagerOwner::DispatchGetTextLocationResult(
const AXActionData& data,
const std::optional<gfx::Rect>& rect) {
GetAutomationV8Bindings()->SendGetTextLocationResult(data, rect);
}
#endif
}