Enable right clicking on the applist doodle web contents and log the data.
[chromium-blink-merge.git] / ui / accessibility / ax_tree_update.h
blob5a92c165bb614a6f351fecd25778af37f726a0d2
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_ACCESSIBILITY_AX_TREE_UPDATE_H_
6 #define UI_ACCESSIBILITY_AX_TREE_UPDATE_H_
8 #include <string>
9 #include <vector>
11 #include "ui/accessibility/ax_node_data.h"
13 namespace ui {
15 // An AXTreeUpdate is a serialized representation of an atomic change
16 // to an AXTree. The sender and receiver must be in sync; the update
17 // is only meant to bring the tree from a specific previous state into
18 // its next state. Trying to apply it to the wrong tree should immediately
19 // die with a fatal assertion.
21 // An AXTreeUpdate consists of an optional node id to clear (meaning
22 // that all of that node's children and their descendants are deleted),
23 // followed by an ordered vector of AXNodeData structures to be applied
24 // to the tree in order.
26 // Suppose that the next AXNodeData to be applied is |node|. The following
27 // invariants must hold:
28 // 1. Either |node.id| is already in the tree, or else the tree is empty,
29 // |node| is the new root of the tree, and
30 // |node.role| == WebAXRoleRootWebArea.
31 // 2. Every child id in |node.child_ids| must either be already a child
32 // of this node, or a new id not previously in the tree. It is not
33 // allowed to "reparent" a child to this node without first removing
34 // that child from its previous parent.
35 // 3. When a new id appears in |node.child_ids|, the tree should create a
36 // new uninitialized placeholder node for it immediately. That
37 // placeholder must be updated within the same AXTreeUpdate, otherwise
38 // it's a fatal error. This guarantees the tree is always complete
39 // before or after an AXTreeUpdate.
40 struct AX_EXPORT AXTreeUpdate {
41 AXTreeUpdate();
42 ~AXTreeUpdate();
44 // The id of a node to clear, before applying any updates,
45 // or 0 if no nodes should be cleared. Clearing a node means deleting
46 // all of its children and their descendants, but leaving that node in
47 // the tree. It's an error to clear a node but not subsequently update it
48 // as part of the tree update.
49 int node_id_to_clear;
51 // A vector of nodes to update, according to the rules above.
52 std::vector<AXNodeData> nodes;
54 // Return a multi-line indented string representation, for logging.
55 std::string ToString() const;
57 // TODO(dmazzoni): location changes
60 } // namespace ui
62 #endif // UI_ACCESSIBILITY_AX_TREE_UPDATE_H_