Commit d3dedf79 authored by tfarina@chromium.org's avatar tfarina@chromium.org

Do not check against child_count() > 0, instead check if node is not empty().

Use TreeNode::empty() accessor function for checking if node has children or if
it isn't empty, instead of using child_count().

BUG=None
TEST=None

R=gbillock@chromium.org

Review URL: http://codereview.chromium.org/7775001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98639 0039d316-1c4b-4281-b951-d872f2087c98
parent c1541a5a
...@@ -95,7 +95,7 @@ void IntentsModel::GetIntentsTreeNodeDictionary(const IntentsTreeNode& node, ...@@ -95,7 +95,7 @@ void IntentsModel::GetIntentsTreeNodeDictionary(const IntentsTreeNode& node,
if (node.Type() == IntentsTreeNode::TYPE_ORIGIN) { if (node.Type() == IntentsTreeNode::TYPE_ORIGIN) {
dict->SetString("site", node.GetTitle()); dict->SetString("site", node.GetTitle());
dict->SetBoolean("hasChildren", node.child_count() > 0); dict->SetBoolean("hasChildren", !node.empty());
return; return;
} }
......
...@@ -103,7 +103,7 @@ void IntentsSettingsHandler::RemoveIntent(const base::ListValue* args) { ...@@ -103,7 +103,7 @@ void IntentsSettingsHandler::RemoveIntent(const base::ListValue* args) {
void IntentsSettingsHandler::RemoveOrigin(IntentsTreeNode* node) { void IntentsSettingsHandler::RemoveOrigin(IntentsTreeNode* node) {
// TODO(gbillock): This is a known batch update. Worth optimizing? // TODO(gbillock): This is a known batch update. Worth optimizing?
while (node->child_count() > 0) { while (!node->empty()) {
IntentsTreeNode* cnode = node->GetChild(0); IntentsTreeNode* cnode = node->GetChild(0);
CHECK(cnode->Type() == IntentsTreeNode::TYPE_SERVICE); CHECK(cnode->Type() == IntentsTreeNode::TYPE_SERVICE);
ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(cnode); ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(cnode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment