OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_ACCESSIBILITY_AX_TREE_SOURCE_H_ | 5 #ifndef UI_ACCESSIBILITY_AX_TREE_SOURCE_H_ |
6 #define UI_ACCESSIBILITY_AX_TREE_SOURCE_H_ | 6 #define UI_ACCESSIBILITY_AX_TREE_SOURCE_H_ |
7 | 7 |
8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 // An AXTreeSource is an abstract interface for a serializable | 12 // An AXTreeSource is an abstract interface for a serializable |
13 // accessibility tree. The tree may be in some other format or | 13 // accessibility tree. The tree may be in some other format or |
14 // may be computed dynamically, but maintains the properties that | 14 // may be computed dynamically, but maintains the properties that |
15 // it's a strict tree, it has a unique id for each node, and all | 15 // it's a strict tree, it has a unique id for each node, and all |
16 // of the accessibility information about a node can be serialized | 16 // of the accessibility information about a node can be serialized |
17 // as an AXNodeData. This is the primary interface to use when | 17 // as an AXNodeData. This is the primary interface to use when |
18 // an accessibility tree will be sent over an IPC before being | 18 // an accessibility tree will be sent over an IPC before being |
19 // consumed. | 19 // consumed. |
20 template<class AXNodeSource> | 20 template<class AXNodeSource> |
21 class AX_EXPORT AXTreeSource { | 21 class AX_EXPORT AXTreeSource { |
22 public: | 22 public: |
23 virtual ~AXTreeSource() {} | 23 virtual ~AXTreeSource() {} |
| 24 virtual AXNodeSource* GetRoot() const = 0; |
24 virtual AXNodeSource* GetFromId(int32 id) const = 0; | 25 virtual AXNodeSource* GetFromId(int32 id) const = 0; |
25 virtual int32 GetId(const AXNodeSource* node) const = 0; | 26 virtual int32 GetId(const AXNodeSource* node) const = 0; |
26 virtual int GetChildCount(const AXNodeSource* node) const = 0; | 27 virtual int GetChildCount(const AXNodeSource* node) const = 0; |
27 virtual AXNodeSource* GetChildAtIndex(const AXNodeSource* node, int index) | 28 virtual AXNodeSource* GetChildAtIndex(const AXNodeSource* node, int index) |
28 const = 0; | 29 const = 0; |
29 | 30 virtual AXNodeSource* GetParent(const AXNodeSource* node) const = 0; |
30 // Returns the id of this node's parent, or 0 if it doesn't have a parent. | |
31 virtual int32 GetParentId(const AXNodeSource* node) const = 0; | |
32 | 31 |
33 // Serialize one node in the tree. | 32 // Serialize one node in the tree. |
34 virtual void SerializeNode( | 33 virtual void SerializeNode( |
35 const AXNodeSource* node, AXNodeData* out_data) const = 0; | 34 const AXNodeSource* node, AXNodeData* out_data) const = 0; |
36 | 35 |
37 protected: | 36 protected: |
38 AXTreeSource() {} | 37 AXTreeSource() {} |
39 }; | 38 }; |
40 | 39 |
41 } // namespace ui | 40 } // namespace ui |
42 | 41 |
43 #endif // UI_ACCESSIBILITY_AX_TREE_SOURCE_H_ | 42 #endif // UI_ACCESSIBILITY_AX_TREE_SOURCE_H_ |
OLD | NEW |