| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_intents_model.h" | 5 #include "chrome/browser/ui/intents/web_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/default_web_intent_service.h" |
| 10 #include "chrome/browser/intents/web_intents_registry.h" | 11 #include "chrome/browser/intents/web_intents_registry.h" |
| 11 | 12 |
| 12 WebIntentsTreeNode::WebIntentsTreeNode() | 13 WebIntentsTreeNode::WebIntentsTreeNode() |
| 13 : ui::TreeNode<WebIntentsTreeNode>(string16()), | 14 : ui::TreeNode<WebIntentsTreeNode>(string16()), |
| 14 type_(TYPE_ROOT) {} | 15 type_(TYPE_ROOT) {} |
| 15 | 16 |
| 16 WebIntentsTreeNode::WebIntentsTreeNode(const string16& title) | 17 WebIntentsTreeNode::WebIntentsTreeNode(const string16& title) |
| 17 : ui::TreeNode<WebIntentsTreeNode>(title), | 18 : ui::TreeNode<WebIntentsTreeNode>(title), |
| 18 type_(TYPE_ORIGIN) {} | 19 type_(TYPE_ORIGIN) {} |
| 19 | 20 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 GURL icon_url = services[i].service_url.GetOrigin().Resolve("/favicon.ico"); | 148 GURL icon_url = services[i].service_url.GetOrigin().Resolve("/favicon.ico"); |
| 148 ns->SetIconUrl(ASCIIToUTF16(icon_url.spec())); | 149 ns->SetIconUrl(ASCIIToUTF16(icon_url.spec())); |
| 149 ns->SetAction(services[i].action); | 150 ns->SetAction(services[i].action); |
| 150 ns->AddType(services[i].type); | 151 ns->AddType(services[i].type); |
| 151 Add(n, ns, n->child_count()); | 152 Add(n, ns, n->child_count()); |
| 152 } | 153 } |
| 153 | 154 |
| 154 NotifyObserverEndBatch(); | 155 NotifyObserverEndBatch(); |
| 155 } | 156 } |
| 156 | 157 |
| 158 void WebIntentsModel::OnIntentsDefaultsQueryDone( |
| 159 WebIntentsRegistry::QueryID query_id, |
| 160 const DefaultWebIntentService& default_service) { |
| 161 } |
| 162 |
| 157 void WebIntentsModel::NotifyObserverBeginBatch() { | 163 void WebIntentsModel::NotifyObserverBeginBatch() { |
| 158 // Only notify the model once if we're batching in a nested manner. | 164 // Only notify the model once if we're batching in a nested manner. |
| 159 if (batch_update_++ == 0) { | 165 if (batch_update_++ == 0) { |
| 160 FOR_EACH_OBSERVER(Observer, | 166 FOR_EACH_OBSERVER(Observer, |
| 161 intents_observer_list_, | 167 intents_observer_list_, |
| 162 TreeModelBeginBatch(this)); | 168 TreeModelBeginBatch(this)); |
| 163 } | 169 } |
| 164 } | 170 } |
| 165 | 171 |
| 166 void WebIntentsModel::NotifyObserverEndBatch() { | 172 void WebIntentsModel::NotifyObserverEndBatch() { |
| 167 // Only notify the observers if this is the outermost call to EndBatch() if | 173 // Only notify the observers if this is the outermost call to EndBatch() if |
| 168 // called in a nested manner. | 174 // called in a nested manner. |
| 169 if (--batch_update_ == 0) { | 175 if (--batch_update_ == 0) { |
| 170 FOR_EACH_OBSERVER(Observer, | 176 FOR_EACH_OBSERVER(Observer, |
| 171 intents_observer_list_, | 177 intents_observer_list_, |
| 172 TreeModelEndBatch(this)); | 178 TreeModelEndBatch(this)); |
| 173 } | 179 } |
| 174 } | 180 } |
| OLD | NEW |