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

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

Issue 67283004: First step to move common accessibility code out of content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Git rid of AX_EXPORT from templatized function Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ui/accessibility/ax_export.h ('k') | ui/accessibility/ax_node.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_ACCESSIBILITY_AX_NODE_H_
6 #define UI_ACCESSIBILITY_AX_NODE_H_
7
8 #include "ui/accessibility/ax_node_data.h"
9
10 namespace ui {
11
12 // One node in an AXTree.
13 class AX_EXPORT AXNode {
14 public:
15 // The constructor requires a parent, id, and index in parent, but
16 // the data is not required. After initialization, only index_in_parent
17 // is allowed to change, the others are guaranteed to never change.
18 AXNode(AXNode* parent, int32 id, int32 index_in_parent);
19 virtual ~AXNode();
20
21 // Accessors.
22 int32 id() const { return data_.id; }
23 AXNode* parent() const { return parent_; }
24 int child_count() const { return static_cast<int>(children_.size()); }
25 const AXNodeData& data() const { return data_; }
26 const std::vector<AXNode*>& children() const { return children_; }
27
28 // Get the child at the given index.
29 AXNode* ChildAtIndex(int index) const { return children_[index]; }
30
31 // Set the node's accessibility data. This may be done during initial
32 // initialization or later when the node data changes.
33 virtual void SetData(const AXNodeData& src);
34
35 // Set the index in parent, for example if siblings were inserted or deleted.
36 void SetIndexInParent(int index_in_parent);
37
38 // Swap the internal children vector with |children|. This instance
39 // now owns all of the passed children.
40 virtual void SwapChildren(std::vector<AXNode*>& children);
41
42 // This is called when the AXTree no longer includes this node in the
43 // tree. Reference counting is used on some platforms because the
44 // operating system may hold onto a reference to an AXNode
45 // object even after we're through with it, so this may decrement the
46 // reference count and clear out the object's data.
47 virtual void Destroy();
48
49 private:
50 int index_in_parent_;
51 AXNode* parent_;
52 std::vector<AXNode*> children_;
53 AXNodeData data_;
54 };
55
56
57 } // namespace ui
58
59 #endif // UI_ACCESSIBILITY_AX_NODE_H_
OLDNEW
« no previous file with comments | « ui/accessibility/ax_export.h ('k') | ui/accessibility/ax_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698