#include "ui/views/accessibility/ax_window_obj_wrapper.h"
#include <stddef.h>
#include <string>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "build/chromeos_buildflags.h"
#include "ui/accessibility/aura/aura_window_properties.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/ax_tree_id.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/window_tree_host.h"
#include "ui/aura/window_tree_host_platform.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/compositor/layer.h"
#include "ui/views/accessibility/ax_aura_obj_cache.h"
#include "ui/views/widget/widget.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h"
#endif
namespace views {
namespace {
Widget* GetWidgetForWindow(aura::Window* window) { … }
void FireEventOnWindowChildWidgetAndRootView(aura::Window* window,
ax::mojom::Event event,
AXAuraObjCache* cache) { … }
void FireLocationChangesRecursively(aura::Window* window,
AXAuraObjCache* cache) { … }
std::string GetWindowName(aura::Window* window) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS)
std::string GetPlatformWindowId(aura::Window* window) {
if (!window->IsRootWindow() || window->parent())
return std::string();
aura::WindowTreeHost* window_tree_host = window->GetHost();
if (!window_tree_host)
return std::string();
DesktopWindowTreeHostPlatform* desktop_window_tree_host_platform =
DesktopWindowTreeHostPlatform::GetHostForWidget(
window_tree_host->GetAcceleratedWidget());
if (!desktop_window_tree_host_platform)
return window_tree_host->GetUniqueId();
while (desktop_window_tree_host_platform->window_parent()) {
desktop_window_tree_host_platform =
desktop_window_tree_host_platform->window_parent();
}
return desktop_window_tree_host_platform->GetUniqueId();
}
#endif
}
AXWindowObjWrapper::AXWindowObjWrapper(AXAuraObjCache* aura_obj_cache,
aura::Window* window)
: … { … }
AXWindowObjWrapper::~AXWindowObjWrapper() = default;
bool AXWindowObjWrapper::HandleAccessibleAction(
const ui::AXActionData& action) { … }
AXAuraObjWrapper* AXWindowObjWrapper::GetParent() { … }
void AXWindowObjWrapper::GetChildren(
std::vector<raw_ptr<AXAuraObjWrapper, VectorExperimental>>* out_children) { … }
void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) { … }
ui::AXNodeID AXWindowObjWrapper::GetUniqueId() const { … }
std::string AXWindowObjWrapper::ToString() const { … }
void AXWindowObjWrapper::OnCaretBoundsChanged(
const ui::TextInputClient* client) { … }
void AXWindowObjWrapper::OnWindowDestroyed(aura::Window* window) { … }
void AXWindowObjWrapper::OnWindowDestroying(aura::Window* window) { … }
void AXWindowObjWrapper::OnWindowHierarchyChanged(
const HierarchyChangeParams& params) { … }
void AXWindowObjWrapper::OnWindowBoundsChanged(
aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds,
ui::PropertyChangeReason reason) { … }
void AXWindowObjWrapper::OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) { … }
void AXWindowObjWrapper::OnWindowVisibilityChanged(aura::Window* window,
bool visible) { … }
void AXWindowObjWrapper::OnWindowTransformed(aura::Window* window,
ui::PropertyChangeReason reason) { … }
void AXWindowObjWrapper::OnWindowTitleChanged(aura::Window* window) { … }
void AXWindowObjWrapper::FireEvent(ax::mojom::Event event_type) { … }
}