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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // should not be trusted any longer. | 101 // should not be trusted any longer. |
102 virtual bool Unserialize(const AXTreeUpdate& update); | 102 virtual bool Unserialize(const AXTreeUpdate& update); |
103 | 103 |
104 // Return a multi-line indented string representation, for logging. | 104 // Return a multi-line indented string representation, for logging. |
105 std::string ToString() const; | 105 std::string ToString() const; |
106 | 106 |
107 // A string describing the error from an unsuccessful Unserialize, | 107 // A string describing the error from an unsuccessful Unserialize, |
108 // for testing and debugging. | 108 // for testing and debugging. |
109 const std::string& error() const { return error_; } | 109 const std::string& error() const { return error_; } |
110 | 110 |
| 111 int size() { return static_cast<int>(id_map_.size()); } |
| 112 |
111 private: | 113 private: |
112 AXNode* CreateNode(AXNode* parent, int32 id, int32 index_in_parent); | 114 AXNode* CreateNode(AXNode* parent, int32 id, int32 index_in_parent); |
113 | 115 |
114 // This is called from within Unserialize(), it returns true on success. | 116 // This is called from within Unserialize(), it returns true on success. |
115 bool UpdateNode(const AXNodeData& src, AXTreeUpdateState* update_state); | 117 bool UpdateNode(const AXNodeData& src, AXTreeUpdateState* update_state); |
116 | 118 |
117 void OnRootChanged(); | 119 void OnRootChanged(); |
118 | 120 |
119 // Notify the delegate that the subtree rooted at |node| will be destroyed, | 121 // Notify the delegate that the subtree rooted at |node| will be destroyed, |
120 // then call DestroyNodeAndSubtree on it. | 122 // then call DestroyNodeAndSubtree on it. |
(...skipping 21 matching lines...) Expand all Loading... |
142 | 144 |
143 AXTreeDelegate* delegate_; | 145 AXTreeDelegate* delegate_; |
144 AXNode* root_; | 146 AXNode* root_; |
145 base::hash_map<int32, AXNode*> id_map_; | 147 base::hash_map<int32, AXNode*> id_map_; |
146 std::string error_; | 148 std::string error_; |
147 }; | 149 }; |
148 | 150 |
149 } // namespace ui | 151 } // namespace ui |
150 | 152 |
151 #endif // UI_ACCESSIBILITY_AX_TREE_H_ | 153 #endif // UI_ACCESSIBILITY_AX_TREE_H_ |
OLD | NEW |