Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: ui/accessibility/ax_tree.h

Issue 940753002: accessibility: Simpler AXTree root accessor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/accessibility/ax_serializable_tree.cc ('k') | ui/accessibility/ax_tree.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // It's designed to be subclassed to implement support for native 84 // It's designed to be subclassed to implement support for native
85 // accessibility APIs on a specific platform. 85 // accessibility APIs on a specific platform.
86 class AX_EXPORT AXTree { 86 class AX_EXPORT AXTree {
87 public: 87 public:
88 AXTree(); 88 AXTree();
89 explicit AXTree(const AXTreeUpdate& initial_state); 89 explicit AXTree(const AXTreeUpdate& initial_state);
90 virtual ~AXTree(); 90 virtual ~AXTree();
91 91
92 virtual void SetDelegate(AXTreeDelegate* delegate); 92 virtual void SetDelegate(AXTreeDelegate* delegate);
93 93
94 virtual AXNode* GetRoot() const; 94 AXNode* root() const { return root_; }
95 virtual AXNode* GetFromId(int32 id) const; 95
96 // Returns the AXNode with the given |id| if it is part of this AXTree.
97 AXNode* GetFromId(int32 id) const;
96 98
97 // Returns true on success. If it returns false, it's a fatal error 99 // Returns true on success. If it returns false, it's a fatal error
98 // and this tree should be destroyed, and the source of the tree update 100 // and this tree should be destroyed, and the source of the tree update
99 // should not be trusted any longer. 101 // should not be trusted any longer.
100 virtual bool Unserialize(const AXTreeUpdate& update); 102 virtual bool Unserialize(const AXTreeUpdate& update);
101 103
102 // Return a multi-line indented string representation, for logging. 104 // Return a multi-line indented string representation, for logging.
103 std::string ToString() const; 105 std::string ToString() const;
104 106
105 // A string describing the error from an unsuccessful Unserialize, 107 // A string describing the error from an unsuccessful Unserialize,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 142
141 AXTreeDelegate* delegate_; 143 AXTreeDelegate* delegate_;
142 AXNode* root_; 144 AXNode* root_;
143 base::hash_map<int32, AXNode*> id_map_; 145 base::hash_map<int32, AXNode*> id_map_;
144 std::string error_; 146 std::string error_;
145 }; 147 };
146 148
147 } // namespace ui 149 } // namespace ui
148 150
149 #endif // UI_ACCESSIBILITY_AX_TREE_H_ 151 #endif // UI_ACCESSIBILITY_AX_TREE_H_
OLDNEW
« no previous file with comments | « ui/accessibility/ax_serializable_tree.cc ('k') | ui/accessibility/ax_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698