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

Side by Side Diff: chrome/browser/ui/webui/options/intents_settings_handler.cc

Issue 7775001: Do not check against child_count() > 0, instead check if node is not empty(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/intents/intents_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/webui/options/intents_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/intents_settings_handler.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/browsing_data_appcache_helper.h" 9 #include "chrome/browser/browsing_data_appcache_helper.h"
10 #include "chrome/browser/browsing_data_database_helper.h" 10 #include "chrome/browser/browsing_data_database_helper.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (node->Type() == IntentsTreeNode::TYPE_ORIGIN) { 96 if (node->Type() == IntentsTreeNode::TYPE_ORIGIN) {
97 RemoveOrigin(node); 97 RemoveOrigin(node);
98 } else if (node->Type() == IntentsTreeNode::TYPE_SERVICE) { 98 } else if (node->Type() == IntentsTreeNode::TYPE_SERVICE) {
99 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(node); 99 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(node);
100 RemoveService(snode); 100 RemoveService(snode);
101 } 101 }
102 } 102 }
103 103
104 void IntentsSettingsHandler::RemoveOrigin(IntentsTreeNode* node) { 104 void IntentsSettingsHandler::RemoveOrigin(IntentsTreeNode* node) {
105 // TODO(gbillock): This is a known batch update. Worth optimizing? 105 // TODO(gbillock): This is a known batch update. Worth optimizing?
106 while (node->child_count() > 0) { 106 while (!node->empty()) {
107 IntentsTreeNode* cnode = node->GetChild(0); 107 IntentsTreeNode* cnode = node->GetChild(0);
108 CHECK(cnode->Type() == IntentsTreeNode::TYPE_SERVICE); 108 CHECK(cnode->Type() == IntentsTreeNode::TYPE_SERVICE);
109 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(cnode); 109 ServiceTreeNode* snode = static_cast<ServiceTreeNode*>(cnode);
110 RemoveService(snode); 110 RemoveService(snode);
111 } 111 }
112 delete intents_tree_model_->Remove(node->parent(), node); 112 delete intents_tree_model_->Remove(node->parent(), node);
113 } 113 }
114 114
115 void IntentsSettingsHandler::RemoveService(ServiceTreeNode* snode) { 115 void IntentsSettingsHandler::RemoveService(ServiceTreeNode* snode) {
116 WebIntentData provider; 116 WebIntentData provider;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 children); 150 children);
151 151
152 ListValue args; 152 ListValue args;
153 args.Append(parent == intents_tree_model_->GetRoot() ? 153 args.Append(parent == intents_tree_model_->GetRoot() ?
154 Value::CreateNullValue() : 154 Value::CreateNullValue() :
155 Value::CreateStringValue(intents_tree_model_->GetTreeNodeId(parent))); 155 Value::CreateStringValue(intents_tree_model_->GetTreeNodeId(parent)));
156 args.Append(children); 156 args.Append(children);
157 157
158 web_ui_->CallJavascriptFunction("IntentsView.loadChildren", args); 158 web_ui_->CallJavascriptFunction("IntentsView.loadChildren", args);
159 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/intents_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698