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

Side by Side Diff: chrome/browser/ui/intents/intents_model.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 | « no previous file | chrome/browser/ui/webui/options/intents_settings_handler.cc » ('j') | 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/intents/intents_model.h" 5 #include "chrome/browser/ui/intents/intents_model.h"
6 #include "base/string_split.h" 6 #include "base/string_split.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/intents/web_intents_registry.h" 10 #include "chrome/browser/intents/web_intents_registry.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 void IntentsModel::GetIntentsTreeNodeDictionary(const IntentsTreeNode& node, 90 void IntentsModel::GetIntentsTreeNodeDictionary(const IntentsTreeNode& node,
91 base::DictionaryValue* dict) { 91 base::DictionaryValue* dict) {
92 if (node.Type() == IntentsTreeNode::TYPE_ROOT) { 92 if (node.Type() == IntentsTreeNode::TYPE_ROOT) {
93 return; 93 return;
94 } 94 }
95 95
96 if (node.Type() == IntentsTreeNode::TYPE_ORIGIN) { 96 if (node.Type() == IntentsTreeNode::TYPE_ORIGIN) {
97 dict->SetString("site", node.GetTitle()); 97 dict->SetString("site", node.GetTitle());
98 dict->SetBoolean("hasChildren", node.child_count() > 0); 98 dict->SetBoolean("hasChildren", !node.empty());
99 return; 99 return;
100 } 100 }
101 101
102 if (node.Type() == IntentsTreeNode::TYPE_SERVICE) { 102 if (node.Type() == IntentsTreeNode::TYPE_SERVICE) {
103 const ServiceTreeNode* snode = static_cast<const ServiceTreeNode*>(&node); 103 const ServiceTreeNode* snode = static_cast<const ServiceTreeNode*>(&node);
104 dict->SetString("site", snode->GetTitle()); 104 dict->SetString("site", snode->GetTitle());
105 dict->SetString("name", snode->ServiceName()); 105 dict->SetString("name", snode->ServiceName());
106 dict->SetString("url", snode->ServiceUrl()); 106 dict->SetString("url", snode->ServiceUrl());
107 dict->SetString("icon", snode->IconUrl()); 107 dict->SetString("icon", snode->IconUrl());
108 dict->SetString("action", snode->Action()); 108 dict->SetString("action", snode->Action());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 void IntentsModel::NotifyObserverEndBatch() { 154 void IntentsModel::NotifyObserverEndBatch() {
155 // Only notify the observers if this is the outermost call to EndBatch() if 155 // Only notify the observers if this is the outermost call to EndBatch() if
156 // called in a nested manner. 156 // called in a nested manner.
157 if (--batch_update_ == 0) { 157 if (--batch_update_ == 0) {
158 FOR_EACH_OBSERVER(Observer, 158 FOR_EACH_OBSERVER(Observer,
159 intents_observer_list_, 159 intents_observer_list_,
160 TreeModelEndBatch(this)); 160 TreeModelEndBatch(this));
161 } 161 }
162 } 162 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/intents_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698