#include "extensions/browser/api/automation_internal/automation_event_router.h"
#include <memory>
#include <string>
#include <utility>
#include "base/containers/contains.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "extensions/browser/api/automation_internal/automation_internal_api_delegate.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/process_manager.h"
#include "extensions/common/api/automation_internal.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_node_data.h"
namespace extensions {
AutomationEventRouter* AutomationEventRouter::GetInstance() { … }
AutomationEventRouter::AutomationEventRouter() { … }
AutomationEventRouter::~AutomationEventRouter() { … }
void AutomationEventRouter::RegisterListenerForOneTree(
const ExtensionId& extension_id,
const RenderProcessHostId& listener_rph_id,
content::WebContents* web_contents,
ui::AXTreeID source_ax_tree_id) { … }
void AutomationEventRouter::RegisterListenerWithDesktopPermission(
const ExtensionId& extension_id,
const RenderProcessHostId& listener_rph_id,
content::WebContents* web_contents) { … }
void AutomationEventRouter::UnregisterListenerWithDesktopPermission(
const RenderProcessHostId& listener_rph_id) { … }
void AutomationEventRouter::UnregisterAllListenersWithDesktopPermission() { … }
void AutomationEventRouter::DispatchAccessibilityLocationChange(
const ui::AXLocationChanges& details) { … }
void AutomationEventRouter::DispatchTreeDestroyedEvent(ui::AXTreeID tree_id) { … }
void AutomationEventRouter::DispatchActionResult(
const ui::AXActionData& data,
bool result,
content::BrowserContext* browser_context) { … }
void AutomationEventRouter::DispatchGetTextLocationDataResult(
const ui::AXActionData& data,
const std::optional<gfx::Rect>& rect) { … }
void AutomationEventRouter::NotifyAllAutomationExtensionsGone() { … }
void AutomationEventRouter::NotifyExtensionListenerAdded() { … }
void AutomationEventRouter::AddObserver(
AutomationEventRouterObserver* observer) { … }
void AutomationEventRouter::RemoveObserver(
AutomationEventRouterObserver* observer) { … }
bool AutomationEventRouter::HasObserver(
AutomationEventRouterObserver* observer) { … }
void AutomationEventRouter::RegisterRemoteRouter(
AutomationEventRouterInterface* router) { … }
AutomationEventRouter::AutomationListener::AutomationListener(
content::WebContents* web_contents)
: … { … }
AutomationEventRouter::AutomationListener::~AutomationListener() = default;
void AutomationEventRouter::AutomationListener::PrimaryPageChanged(
content::Page& page) { … }
void AutomationEventRouter::Register(const ExtensionId& extension_id,
const RenderProcessHostId& listener_rph_id,
content::WebContents* web_contents,
ui::AXTreeID ax_tree_id,
bool desktop) { … }
void AutomationEventRouter::DispatchAccessibilityEvents(
const ui::AXTreeID& tree_id,
const std::vector<ui::AXTreeUpdate>& updates,
const gfx::Point& mouse_location,
const std::vector<ui::AXEvent>& events) { … }
void AutomationEventRouter::RenderProcessExited(
content::RenderProcessHost* host,
const content::ChildProcessTerminationInfo& info) { … }
void AutomationEventRouter::RenderProcessHostDestroyed(
content::RenderProcessHost* host) { … }
void AutomationEventRouter::RemoveAutomationListener(
content::RenderProcessHost* host) { … }
void AutomationEventRouter::TreeRemoved(ui::AXTreeID ax_tree_id) { … }
AutomationEventRouter::AutomationListener*
AutomationEventRouter::GetListenerByRenderProcessID(
const RenderProcessHostId& listener_rph_id) const { … }
void AutomationEventRouter::BindAutomation(
mojo::PendingAssociatedRemote<ax::mojom::Automation> automation) { … }
void AutomationEventRouter::BindForRenderer(
RenderProcessHostId render_process_id,
mojo::PendingAssociatedReceiver<
extensions::mojom::RendererAutomationRegistry> receiver) { … }
}