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_H_ | 5 #ifndef UI_ACCESSIBILITY_AX_TREE_H_ |
6 #define UI_ACCESSIBILITY_AX_TREE_H_ | 6 #define UI_ACCESSIBILITY_AX_TREE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 virtual ~AXTree(); | 28 virtual ~AXTree(); |
29 | 29 |
30 virtual AXNode* GetRoot() const; | 30 virtual AXNode* GetRoot() const; |
31 virtual AXNode* GetFromId(int32 id) const; | 31 virtual AXNode* GetFromId(int32 id) const; |
32 | 32 |
33 // Returns true on success. If it returns false, it's a fatal error | 33 // Returns true on success. If it returns false, it's a fatal error |
34 // and this tree should be destroyed, and the source of the tree update | 34 // and this tree should be destroyed, and the source of the tree update |
35 // should not be trusted any longer. | 35 // should not be trusted any longer. |
36 virtual bool Unserialize(const AXTreeUpdate& update); | 36 virtual bool Unserialize(const AXTreeUpdate& update); |
37 | 37 |
| 38 // Return a multi-line indented string representation, for logging. |
| 39 std::string ToString() const; |
| 40 |
38 // A string describing the error from an unsuccessful Unserialize, | 41 // A string describing the error from an unsuccessful Unserialize, |
39 // for testing and debugging. | 42 // for testing and debugging. |
40 const std::string& error() { return error_; } | 43 const std::string& error() { return error_; } |
41 | 44 |
42 protected: | 45 protected: |
43 // Subclasses can override this to use a subclass of AXNode. | 46 // Subclasses can override this to use a subclass of AXNode. |
44 virtual AXNode* CreateNode(AXNode* parent, int32 id, int32 index_in_parent); | 47 virtual AXNode* CreateNode(AXNode* parent, int32 id, int32 index_in_parent); |
45 | 48 |
46 // This is called from within Unserialize(), it returns true on success. | 49 // This is called from within Unserialize(), it returns true on success. |
47 // Subclasses can override this to do additional processing. |pending_nodes| | 50 // Subclasses can override this to do additional processing. |pending_nodes| |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 std::set<AXNode*>* pending_nodes); | 84 std::set<AXNode*>* pending_nodes); |
82 | 85 |
83 AXNode* root_; | 86 AXNode* root_; |
84 base::hash_map<int32, AXNode*> id_map_; | 87 base::hash_map<int32, AXNode*> id_map_; |
85 std::string error_; | 88 std::string error_; |
86 }; | 89 }; |
87 | 90 |
88 } // namespace ui | 91 } // namespace ui |
89 | 92 |
90 #endif // UI_ACCESSIBILITY_AX_TREE_H_ | 93 #endif // UI_ACCESSIBILITY_AX_TREE_H_ |
OLD | NEW |