From d3dedf792aa86c5d8b174f3d424b9f02ce1c8782 Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Mon, 29 Aug 2011 16:11:49 +0000 Subject: 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 --- chrome/browser/ui/intents/intents_model.cc | 2 +- chrome/browser/ui/webui/options/intents_settings_handler.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/browser/ui/intents/intents_model.cc b/chrome/browser/ui/intents/intents_model.cc index 919dbe3..4aa0911 100644 --- a/chrome/browser/ui/intents/intents_model.cc +++ b/chrome/browser/ui/intents/intents_model.cc @@ -95,7 +95,7 @@ void IntentsModel::GetIntentsTreeNodeDictionary(const IntentsTreeNode& node, if (node.Type() == IntentsTreeNode::TYPE_ORIGIN) { dict->SetString("site", node.GetTitle()); - dict->SetBoolean("hasChildren", node.child_count() > 0); + dict->SetBoolean("hasChildren", !node.empty()); return; } diff --git a/chrome/browser/ui/webui/options/intents_settings_handler.cc b/chrome/browser/ui/webui/options/intents_settings_handler.cc index 42f4868..2656e72 100644 --- a/chrome/browser/ui/webui/options/intents_settings_handler.cc +++ b/chrome/browser/ui/webui/options/intents_settings_handler.cc @@ -103,7 +103,7 @@ void IntentsSettingsHandler::RemoveIntent(const base::ListValue* args) { void IntentsSettingsHandler::RemoveOrigin(IntentsTreeNode* node) { // TODO(gbillock): This is a known batch update. Worth optimizing? - while (node->child_count() > 0) { + while (!node->empty()) { IntentsTreeNode* cnode = node->GetChild(0); CHECK(cnode->Type() == IntentsTreeNode::TYPE_SERVICE); ServiceTreeNode* snode = static_cast(cnode); -- cgit v1.1