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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ui/accessibility/ax_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 // An AXTreeSource is an abstract interface for a serializable | 14 // An AXTreeSource is an abstract interface for a serializable |
15 // accessibility tree. The tree may be in some other format or | 15 // accessibility tree. The tree may be in some other format or |
16 // may be computed dynamically, but maintains the properties that | 16 // may be computed dynamically, but maintains the properties that |
17 // it's a strict tree, it has a unique id for each node, and all | 17 // it's a strict tree, it has a unique id for each node, and all |
18 // of the accessibility information about a node can be serialized | 18 // of the accessibility information about a node can be serialized |
19 // as an AXNodeData. This is the primary interface to use when | 19 // as an AXNodeData. This is the primary interface to use when |
20 // an accessibility tree will be sent over an IPC before being | 20 // an accessibility tree will be sent over an IPC before being |
21 // consumed. | 21 // consumed. |
22 template<typename AXNodeSource> | 22 template<typename AXNodeSource> |
23 class AXTreeSource { | 23 class AX_EXPORT AXTreeSource { |
24 public: | 24 public: |
25 virtual ~AXTreeSource() {} | 25 virtual ~AXTreeSource() {} |
26 | 26 |
27 // Get the root of the tree. | 27 // Get the root of the tree. |
28 virtual AXNodeSource GetRoot() const = 0; | 28 virtual AXNodeSource GetRoot() const = 0; |
29 | 29 |
30 // Get a node by its id. If no node by that id exists in the tree, return a | 30 // Get a node by its id. If no node by that id exists in the tree, return a |
31 // null node, i.e. one that will return false if you call IsValid on it. | 31 // null node, i.e. one that will return false if you call IsValid on it. |
32 virtual AXNodeSource GetFromId(int32 id) const = 0; | 32 virtual AXNodeSource GetFromId(int32 id) const = 0; |
33 | 33 |
(...skipping 21 matching lines...) Expand all Loading... |
55 // Serialize one node in the tree. | 55 // Serialize one node in the tree. |
56 virtual void SerializeNode(AXNodeSource node, AXNodeData* out_data) const = 0; | 56 virtual void SerializeNode(AXNodeSource node, AXNodeData* out_data) const = 0; |
57 | 57 |
58 protected: | 58 protected: |
59 AXTreeSource() {} | 59 AXTreeSource() {} |
60 }; | 60 }; |
61 | 61 |
62 } // namespace ui | 62 } // namespace ui |
63 | 63 |
64 #endif // UI_ACCESSIBILITY_AX_TREE_SOURCE_H_ | 64 #endif // UI_ACCESSIBILITY_AX_TREE_SOURCE_H_ |
OLD | NEW |