Chromium Code Reviews| Index: content/common/ax_node_impl.h |
| diff --git a/content/common/ax_node_impl.h b/content/common/ax_node_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..226cd340cf41bb1563b2bd8f20a05118d868428a |
| --- /dev/null |
| +++ b/content/common/ax_node_impl.h |
| @@ -0,0 +1,69 @@ |
| +// Copyright (c) 2013 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. |
| + |
| +#ifndef CONTENT_COMMON_AX_NODE_IMPL_H_ |
| +#define CONTENT_COMMON_AX_NODE_IMPL_H_ |
| + |
| +#include "content/public/common/ax_node.h" |
| +#include "content/public/common/ax_node_data.h" |
| + |
| +namespace content { |
| + |
| +class AXTreeImpl; |
| + |
| +class CONTENT_EXPORT AXNodeImpl : public AXNode { |
| + public: |
| + AXNodeImpl(); |
| + virtual ~AXNodeImpl(); |
| + |
| + // AXNode. |
|
David Tseng
2013/11/11 19:27:18
nit: AXNode implementation.
dmazzoni
2013/11/12 00:03:04
Done.
|
| + virtual int32 GetId() const OVERRIDE; |
| + virtual AXNode* GetParent() const OVERRIDE; |
| + virtual int GetChildCount() const OVERRIDE; |
| + virtual AXNode* ChildAtIndex(int index) const OVERRIDE; |
| + virtual const AXNodeData& data() const OVERRIDE; |
| + |
| + const std::vector<AXNodeImpl*>& children() const { return children_; } |
| + |
| + // 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
|
| + // not set its data yet. After initialization, only index_in_parent |
| + // is allowed to change, the others are guaranteed to never change. |
| + virtual void Init( |
| + 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
|
| + |
| + // Set the node's accessibility data. This may be done during initial |
| + // initialization or later when the node data changes. |
| + virtual void SetData(const AXNodeData& src); |
| + |
| + // Update the index in parent if siblings were inserted or deleted. |
| + void UpdateIndexInParent(int index_in_parent); |
| + |
| + // Detach all descendants of this subtree and push all of the node pointers, |
| + // including this node, onto the end of |nodes|. |
| + 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.
|
| + |
| + // 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.
|
| + virtual void SwapChildren(std::vector<AXNodeImpl*>& children); |
| + |
| + // Marks this object for deletion, releases our reference to it, |
| + // removes it from the tree, and recursively calls Destroy() on its |
| + // children. May not delete immediately due to reference counting. |
| + // |
| + // Reference counting is used on some platforms because the |
| + // operating system may hold onto a reference to an AXNode |
| + // object even after we're through with it. |
| + virtual void Destroy(); |
| + |
| + private: |
| + int index_in_parent_; |
| + AXNodeImpl* parent_; |
| + AXTreeImpl* tree_; |
| + std::vector<AXNodeImpl*> children_; |
| + AXNodeData data_; |
| +}; |
| + |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_AX_NODE_IMPL_H_ |