Reverse the order of parameters in TreeNode::Add function.
This is so it matches with the signature used in View class.
BUG=None
TEST=None
[email protected]
Review URL: http://codereview.chromium.org/6683024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78712 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/base/models/tree_node_model.h b/ui/base/models/tree_node_model.h
index e0b8e21..9720b8a 100644
--- a/ui/base/models/tree_node_model.h
+++ b/ui/base/models/tree_node_model.h
@@ -73,17 +73,17 @@
virtual ~TreeNode() {}
- // Adds the specified child node.
- virtual void Add(int index, NodeType* child) {
- DCHECK(child);
+ // Adds a TreeNode as a child of this one, at |index|.
+ virtual void Add(NodeType* node, int index) {
+ DCHECK(node);
DCHECK_LE(0, index);
DCHECK_GE(child_count(), index);
// If the node has a parent, remove it from its parent.
- NodeType* node_parent = child->parent();
- if (node_parent)
- node_parent->Remove(node_parent->GetIndexOf(child));
- child->parent_ = static_cast<NodeType*>(this);
- children_->insert(children_->begin() + index, child);
+ NodeType* parent = node->parent();
+ if (parent)
+ parent->Remove(parent->GetIndexOf(node));
+ node->parent_ = static_cast<NodeType*>(this);
+ children_->insert(children_->begin() + index, node);
}
// Removes the node by index. This does NOT delete the specified node, it is
@@ -213,9 +213,9 @@
return static_cast<NodeType*>(model_node);
}
- void Add(NodeType* parent, int index, NodeType* child) {
+ void Add(NodeType* parent, NodeType* child, int index) {
DCHECK(parent && child);
- parent->Add(index, child);
+ parent->Add(child, index);
NotifyObserverTreeNodesAdded(parent, index, 1);
}