summaryrefslogtreecommitdiffstats
path: root/ui/accessibility
diff options
context:
space:
mode:
authortfarina <tfarina@chromium.org>2015-02-18 09:20:32 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-18 17:21:06 +0000
commitd0bfb4b6a4b347b81f3ad25413e57270eaf3b33b (patch)
tree711aeb4b0e54911baaba01d304c95325a65212b1 /ui/accessibility
parentddb19e18fe7298d998a58583bbadca2357bff6d4 (diff)
downloadchromium_src-d0bfb4b6a4b347b81f3ad25413e57270eaf3b33b.zip
chromium_src-d0bfb4b6a4b347b81f3ad25413e57270eaf3b33b.tar.gz
chromium_src-d0bfb4b6a4b347b81f3ad25413e57270eaf3b33b.tar.bz2
accessibility: Some style cleanups.
- IWYU - forward declare - clang formatting - pass-by-reference - const methods BUG=None TEST=accessibility_unittests R=dmazzoni@chromium.org Review URL: https://codereview.chromium.org/926343002 Cr-Commit-Position: refs/heads/master@{#316846}
Diffstat (limited to 'ui/accessibility')
-rw-r--r--ui/accessibility/ax_node.h7
-rw-r--r--ui/accessibility/ax_tree.cc13
-rw-r--r--ui/accessibility/ax_tree.h8
-rw-r--r--ui/accessibility/ax_tree_update.h1
4 files changed, 17 insertions, 12 deletions
diff --git a/ui/accessibility/ax_node.h b/ui/accessibility/ax_node.h
index 5da7340..6fd766c 100644
--- a/ui/accessibility/ax_node.h
+++ b/ui/accessibility/ax_node.h
@@ -5,8 +5,14 @@
#ifndef UI_ACCESSIBILITY_AX_NODE_H_
#define UI_ACCESSIBILITY_AX_NODE_H_
+#include <vector>
+
#include "ui/accessibility/ax_node_data.h"
+namespace gfx {
+class Rect;
+}
+
namespace ui {
// One node in an AXTree.
@@ -62,7 +68,6 @@ class AX_EXPORT AXNode {
AXNodeData data_;
};
-
} // namespace ui
#endif // UI_ACCESSIBILITY_AX_NODE_H_
diff --git a/ui/accessibility/ax_tree.cc b/ui/accessibility/ax_tree.cc
index bb67a47..0d2b68e 100644
--- a/ui/accessibility/ax_tree.cc
+++ b/ui/accessibility/ax_tree.cc
@@ -73,7 +73,7 @@ AXNode* AXTree::GetRoot() const {
AXNode* AXTree::GetFromId(int32 id) const {
base::hash_map<int32, AXNode*>::const_iterator iter = id_map_.find(id);
- return iter != id_map_.end() ? (iter->second) : NULL;
+ return iter != id_map_.end() ? iter->second : NULL;
}
bool AXTree::Unserialize(const AXTreeUpdate& update) {
@@ -142,8 +142,7 @@ std::string AXTree::ToString() const {
return TreeToStringHelper(root_, 0);
}
-AXNode* AXTree::CreateNode(
- AXNode* parent, int32 id, int32 index_in_parent) {
+AXNode* AXTree::CreateNode(AXNode* parent, int32 id, int32 index_in_parent) {
AXNode* new_node = new AXNode(parent, id, index_in_parent);
id_map_[new_node->id()] = new_node;
if (delegate_)
@@ -151,8 +150,8 @@ AXNode* AXTree::CreateNode(
return new_node;
}
-bool AXTree::UpdateNode(
- const AXNodeData& src, AXTreeUpdateState* update_state) {
+bool AXTree::UpdateNode(const AXNodeData& src,
+ AXTreeUpdateState* update_state) {
// This method updates one node in the tree based on serialized data
// received in an AXTreeUpdate. See AXTreeUpdate for pre and post
// conditions.
@@ -222,7 +221,7 @@ void AXTree::DestroyNodeAndSubtree(AXNode* node) {
}
bool AXTree::DeleteOldChildren(AXNode* node,
- const std::vector<int32> new_child_ids) {
+ const std::vector<int32>& new_child_ids) {
// Create a set of child ids in |src| for fast lookup, and return false
// if a duplicate is found;
std::set<int32> new_child_id_set;
@@ -247,7 +246,7 @@ bool AXTree::DeleteOldChildren(AXNode* node,
}
bool AXTree::CreateNewChildVector(AXNode* node,
- const std::vector<int32> new_child_ids,
+ const std::vector<int32>& new_child_ids,
std::vector<AXNode*>* new_children,
AXTreeUpdateState* update_state) {
bool success = true;
diff --git a/ui/accessibility/ax_tree.h b/ui/accessibility/ax_tree.h
index c8470c0..6d04a55 100644
--- a/ui/accessibility/ax_tree.h
+++ b/ui/accessibility/ax_tree.h
@@ -65,7 +65,7 @@ class AX_EXPORT AXTreeDelegate {
this->node = node;
this->type = type;
}
- AXNode *node;
+ AXNode* node;
ChangeType type;
};
@@ -104,7 +104,7 @@ class AX_EXPORT AXTree {
// A string describing the error from an unsuccessful Unserialize,
// for testing and debugging.
- const std::string& error() { return error_; }
+ const std::string& error() const { return error_; }
private:
AXNode* CreateNode(AXNode* parent, int32 id, int32 index_in_parent);
@@ -126,7 +126,7 @@ class AX_EXPORT AXTree {
// child and its subtree if its id is not in |new_child_ids|. Returns
// true on success, false on fatal error.
bool DeleteOldChildren(AXNode* node,
- const std::vector<int32> new_child_ids);
+ const std::vector<int32>& new_child_ids);
// Iterate over |new_child_ids| and populate |new_children| with
// pointers to child nodes, reusing existing nodes already in the tree
@@ -134,7 +134,7 @@ class AX_EXPORT AXTree {
// if the id already exists as the child of another node, that's an
// error. Returns true on success, false on fatal error.
bool CreateNewChildVector(AXNode* node,
- const std::vector<int32> new_child_ids,
+ const std::vector<int32>& new_child_ids,
std::vector<AXNode*>* new_children,
AXTreeUpdateState* update_state);
diff --git a/ui/accessibility/ax_tree_update.h b/ui/accessibility/ax_tree_update.h
index 314a78f..5a92c16 100644
--- a/ui/accessibility/ax_tree_update.h
+++ b/ui/accessibility/ax_tree_update.h
@@ -5,6 +5,7 @@
#ifndef UI_ACCESSIBILITY_AX_TREE_UPDATE_H_
#define UI_ACCESSIBILITY_AX_TREE_UPDATE_H_
+#include <string>
#include <vector>
#include "ui/accessibility/ax_node_data.h"