OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |