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

Side by Side Diff: ui/accessibility/ax_serializable_tree.cc

Issue 667923002: Standardize usage of virtual/override/final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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.h ('k') | ui/accessibility/ax_tree_unittest.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 #include "ui/accessibility/ax_serializable_tree.h" 5 #include "ui/accessibility/ax_serializable_tree.h"
6 6
7 #include "ui/accessibility/ax_node.h" 7 #include "ui/accessibility/ax_node.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
11 // This class is an implementation of the AXTreeSource interface with 11 // This class is an implementation of the AXTreeSource interface with
12 // AXNode as the node type, that just delegates to an AXTree. The purpose 12 // AXNode as the node type, that just delegates to an AXTree. The purpose
13 // of this is so that AXTreeSerializer only needs to work with the 13 // of this is so that AXTreeSerializer only needs to work with the
14 // AXTreeSource abstraction and doesn't need to actually know about 14 // AXTreeSource abstraction and doesn't need to actually know about
15 // AXTree directly. Another AXTreeSource is used to abstract the Blink 15 // AXTree directly. Another AXTreeSource is used to abstract the Blink
16 // accessibility tree. 16 // accessibility tree.
17 class AX_EXPORT AXTreeSourceAdapter : public AXTreeSource<const AXNode*> { 17 class AX_EXPORT AXTreeSourceAdapter : public AXTreeSource<const AXNode*> {
18 public: 18 public:
19 AXTreeSourceAdapter(AXTree* tree) : tree_(tree) {} 19 AXTreeSourceAdapter(AXTree* tree) : tree_(tree) {}
20 virtual ~AXTreeSourceAdapter() {} 20 ~AXTreeSourceAdapter() override {}
21 21
22 // AXTreeSource implementation. 22 // AXTreeSource implementation.
23 virtual AXNode* GetRoot() const override { 23 AXNode* GetRoot() const override { return tree_->GetRoot(); }
24 return tree_->GetRoot();
25 }
26 24
27 virtual AXNode* GetFromId(int32 id) const override { 25 AXNode* GetFromId(int32 id) const override { return tree_->GetFromId(id); }
28 return tree_->GetFromId(id);
29 }
30 26
31 virtual int32 GetId(const AXNode* node) const override { 27 int32 GetId(const AXNode* node) const override { return node->id(); }
32 return node->id();
33 }
34 28
35 virtual void GetChildren( 29 void GetChildren(const AXNode* node,
36 const AXNode* node, 30 std::vector<const AXNode*>* out_children) const override {
37 std::vector<const AXNode*>* out_children) const override {
38 for (int i = 0; i < node->child_count(); ++i) 31 for (int i = 0; i < node->child_count(); ++i)
39 out_children->push_back(node->ChildAtIndex(i)); 32 out_children->push_back(node->ChildAtIndex(i));
40 } 33 }
41 34
42 virtual AXNode* GetParent(const AXNode* node) const override { 35 AXNode* GetParent(const AXNode* node) const override {
43 return node->parent(); 36 return node->parent();
44 } 37 }
45 38
46 virtual bool IsValid(const AXNode* node) const override { 39 bool IsValid(const AXNode* node) const override { return node != NULL; }
47 return node != NULL;
48 }
49 40
50 virtual bool IsEqual(const AXNode* node1, 41 bool IsEqual(const AXNode* node1, const AXNode* node2) const override {
51 const AXNode* node2) const override {
52 return node1 == node2; 42 return node1 == node2;
53 } 43 }
54 44
55 virtual const AXNode* GetNull() const override { 45 const AXNode* GetNull() const override { return NULL; }
56 return NULL;
57 }
58 46
59 virtual void SerializeNode( 47 void SerializeNode(const AXNode* node, AXNodeData* out_data) const override {
60 const AXNode* node, AXNodeData* out_data) const override {
61 *out_data = node->data(); 48 *out_data = node->data();
62 } 49 }
63 50
64 private: 51 private:
65 AXTree* tree_; 52 AXTree* tree_;
66 }; 53 };
67 54
68 AXSerializableTree::AXSerializableTree() 55 AXSerializableTree::AXSerializableTree()
69 : AXTree() {} 56 : AXTree() {}
70 57
71 AXSerializableTree::AXSerializableTree(const AXTreeUpdate& initial_state) 58 AXSerializableTree::AXSerializableTree(const AXTreeUpdate& initial_state)
72 : AXTree(initial_state) { 59 : AXTree(initial_state) {
73 } 60 }
74 61
75 AXSerializableTree::~AXSerializableTree() { 62 AXSerializableTree::~AXSerializableTree() {
76 } 63 }
77 64
78 AXTreeSource<const AXNode*>* AXSerializableTree::CreateTreeSource() { 65 AXTreeSource<const AXNode*>* AXSerializableTree::CreateTreeSource() {
79 return new AXTreeSourceAdapter(this); 66 return new AXTreeSourceAdapter(this);
80 } 67 }
81 68
82 } // namespace ui 69 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_serializable_tree.h ('k') | ui/accessibility/ax_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698