OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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. | |
4 | |
5 #ifndef CONTENT_COMMON_AX_NODE_IMPL_H_ | |
6 #define CONTENT_COMMON_AX_NODE_IMPL_H_ | |
7 | |
8 #include "content/public/common/ax_node.h" | |
9 #include "content/public/common/ax_node_data.h" | |
10 | |
11 namespace content { | |
12 | |
13 class AXTreeImpl; | |
14 | |
15 class CONTENT_EXPORT AXNodeImpl : public AXNode { | |
16 public: | |
17 AXNodeImpl(); | |
18 virtual ~AXNodeImpl(); | |
19 | |
20 // AXNode. | |
David Tseng
2013/11/11 19:27:18
nit: AXNode implementation.
dmazzoni
2013/11/12 00:03:04
Done.
| |
21 virtual int32 GetId() const OVERRIDE; | |
22 virtual AXNode* GetParent() const OVERRIDE; | |
23 virtual int GetChildCount() const OVERRIDE; | |
24 virtual AXNode* ChildAtIndex(int index) const OVERRIDE; | |
25 virtual const AXNodeData& data() const OVERRIDE; | |
26 | |
27 const std::vector<AXNodeImpl*>& children() const { return children_; } | |
28 | |
29 // Initialize the node. This sets up its place in the tree but does | |
David Tseng
2013/11/11 19:27:18
A little confused. Does this mean this is initiali
dmazzoni
2013/11/12 00:03:04
I haven't even added the hook to do platform-speci
| |
30 // not set its data yet. After initialization, only index_in_parent | |
31 // is allowed to change, the others are guaranteed to never change. | |
32 virtual void Init( | |
33 AXTreeImpl* tree, AXNodeImpl* parent, int32 id, int32 index_in_parent); | |
David Tseng
2013/11/11 19:27:18
I'm a little surprised to see this take an AXTreeI
dmazzoni
2013/11/12 00:03:04
Good point. I got rid of the reference to the tree
| |
34 | |
35 // Set the node's accessibility data. This may be done during initial | |
36 // initialization or later when the node data changes. | |
37 virtual void SetData(const AXNodeData& src); | |
38 | |
39 // Update the index in parent if siblings were inserted or deleted. | |
40 void UpdateIndexInParent(int index_in_parent); | |
41 | |
42 // Detach all descendants of this subtree and push all of the node pointers, | |
43 // including this node, onto the end of |nodes|. | |
44 virtual void DetachTree(std::vector<AXNodeImpl*>* nodes); | |
David Tseng
2013/11/11 19:27:18
out_nodes
dmazzoni
2013/11/12 00:03:04
Done.
| |
45 | |
46 // Swap the internal children vector with |children|. | |
David Tseng
2013/11/11 19:27:18
This instance takes ownership?
dmazzoni
2013/11/12 00:03:04
Done.
| |
47 virtual void SwapChildren(std::vector<AXNodeImpl*>& children); | |
48 | |
49 // Marks this object for deletion, releases our reference to it, | |
50 // removes it from the tree, and recursively calls Destroy() on its | |
51 // children. May not delete immediately due to reference counting. | |
52 // | |
53 // Reference counting is used on some platforms because the | |
54 // operating system may hold onto a reference to an AXNode | |
55 // object even after we're through with it. | |
56 virtual void Destroy(); | |
57 | |
58 private: | |
59 int index_in_parent_; | |
60 AXNodeImpl* parent_; | |
61 AXTreeImpl* tree_; | |
62 std::vector<AXNodeImpl*> children_; | |
63 AXNodeData data_; | |
64 }; | |
65 | |
66 | |
67 } // namespace content | |
68 | |
69 #endif // CONTENT_COMMON_AX_NODE_IMPL_H_ | |
OLD | NEW |