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 CONTENT_EXPORT AXNodeImpl : public AXNode { |
| 14 public: |
| 15 AXNodeImpl(); |
| 16 virtual ~AXNodeImpl(); |
| 17 |
| 18 // AXNode implementation. |
| 19 virtual int32 GetId() const OVERRIDE; |
| 20 virtual AXNode* GetParent() const OVERRIDE; |
| 21 virtual int GetChildCount() const OVERRIDE; |
| 22 virtual AXNode* ChildAtIndex(int index) const OVERRIDE; |
| 23 virtual const AXNodeData& data() const OVERRIDE; |
| 24 |
| 25 const std::vector<AXNodeImpl*>& children() const { return children_; } |
| 26 |
| 27 // Initialize the node. This sets up its place in the tree but does |
| 28 // not set its data yet. After initialization, only index_in_parent |
| 29 // is allowed to change, the others are guaranteed to never change. |
| 30 virtual void Init(AXNodeImpl* parent, int32 id, int32 index_in_parent); |
| 31 |
| 32 // Set the node's accessibility data. This may be done during initial |
| 33 // initialization or later when the node data changes. |
| 34 virtual void SetData(const AXNodeData& src); |
| 35 |
| 36 // Update the index in parent if siblings were inserted or deleted. |
| 37 void UpdateIndexInParent(int index_in_parent); |
| 38 |
| 39 // Swap the internal children vector with |children|. This instance |
| 40 // now owns all of the passed children. |
| 41 virtual void SwapChildren(std::vector<AXNodeImpl*>& children); |
| 42 |
| 43 // This is called when the AXTree no longer includes this node in the |
| 44 // tree. Reference counting is used on some platforms because the |
| 45 // operating system may hold onto a reference to an AXNode |
| 46 // object even after we're through with it, so this may decrement the |
| 47 // reference count and clear out the object's data. |
| 48 virtual void Destroy(); |
| 49 |
| 50 private: |
| 51 int index_in_parent_; |
| 52 AXNodeImpl* parent_; |
| 53 std::vector<AXNodeImpl*> children_; |
| 54 AXNodeData data_; |
| 55 }; |
| 56 |
| 57 |
| 58 } // namespace content |
| 59 |
| 60 #endif // CONTENT_COMMON_AX_NODE_IMPL_H_ |
OLD | NEW |