blob: 12eca7873ee7c2a9ae953eb22836360d4040a1e4 [file] [log] [blame]
// Copyright 2014 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.
// This is the implementation layer of the chrome.automation API, and is
// essentially a translation of the internal accessibility tree update system
// into an extension API.
namespace automationInternal {
// Data for an accessibility event and/or an atomic change to an accessibility
// tree. See ui/accessibility/ax_tree_update.h for an extended explanation of
// the tree update format.
[nocompile] dictionary AXEventParams {
// The tree id of the web contents that this update is for.
long treeID;
// ID of the node that the event applies to.
long targetID;
// The type of event that this update represents.
DOMString eventType;
};
// All possible actions that can be performed on automation nodes.
enum ActionType {
focus,
doDefault,
makeVisible,
setSelection,
showContextMenu
};
// Arguments required for all actions supplied to performAction.
dictionary PerformActionRequiredParams {
long treeID;
long automationNodeID;
ActionType actionType;
};
// Arguments for the setSelection action supplied to performAction.
dictionary SetSelectionParams {
// Reuses ActionRequiredParams automationNodeID to mean anchor node id,
// and treeID to apply to both anchor and focus node ids.
long focusNodeID;
long anchorOffset;
long focusOffset;
};
// Arguments for the querySelector function.
dictionary QuerySelectorRequiredParams {
long treeID;
long automationNodeID;
DOMString selector;
};
// Arguments for the enableTab function.
dictionary EnableTabParams {
long routingID;
long? tabID;
};
// Returns the accessibility tree id of the web contents who's accessibility
// was enabled using enableTab().
callback EnableTabCallback = void(long tree_id);
// Callback called when enableDesktop() returns.
callback EnableDesktopCallback = void();
// Callback called when querySelector() returns.
callback QuerySelectorCallback = void(long resultAutomationNodeID);
interface Functions {
// Enable automation of the tab with the given id, or the active tab if no
// tab id is given, and retrieves accessibility tree id for use in
// future updates.
static void enableTab(EnableTabParams args,
EnableTabCallback callback);
// Enable automation of the frame with the given tree id.
static void enableFrame(long tree_id);
// Enables desktop automation.
static void enableDesktop(long routingID,
EnableDesktopCallback callback);
// Performs an action on an automation node.
static void performAction(PerformActionRequiredParams args,
object opt_args);
// Performs a query selector query.
static void querySelector(QuerySelectorRequiredParams args,
QuerySelectorCallback callback);
};
interface Events {
// Fired when an accessibility event occurs
static void onAccessibilityEvent(AXEventParams update);
static void onAccessibilityTreeDestroyed(long treeID);
static void onTreeChange(long observerID,
long treeID,
long nodeID,
DOMString changeType);
static void onChildTreeID(long treeID, long nodeID);
static void onNodesRemoved(long treeID, long[] nodeIDs);
};
};