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/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/web_intents_registry.h" | 10 #include "chrome/browser/intents/web_intents_registry.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 void WebIntentsModel::LoadModel() { | 117 void WebIntentsModel::LoadModel() { |
118 NotifyObserverBeginBatch(); | 118 NotifyObserverBeginBatch(); |
119 intents_registry_->GetAllIntentProviders(this); | 119 intents_registry_->GetAllIntentProviders(this); |
120 } | 120 } |
121 | 121 |
122 void WebIntentsModel::OnIntentsQueryDone( | 122 void WebIntentsModel::OnIntentsQueryDone( |
123 WebIntentsRegistry::QueryID query_id, | 123 WebIntentsRegistry::QueryID query_id, |
124 const std::vector<WebIntentServiceData>& services) { | 124 const std::vector<webkit_glue::WebIntentServiceData>& services) { |
125 for (size_t i = 0; i < services.size(); ++i) { | 125 for (size_t i = 0; i < services.size(); ++i) { |
126 // Eventually do some awesome sorting, grouping, clustering stuff here. | 126 // Eventually do some awesome sorting, grouping, clustering stuff here. |
127 // For now, just stick it in the model flat. | 127 // For now, just stick it in the model flat. |
128 WebIntentsTreeNode* n = new WebIntentsTreeNode(ASCIIToUTF16( | 128 WebIntentsTreeNode* n = new WebIntentsTreeNode(ASCIIToUTF16( |
129 services[i].service_url.host())); | 129 services[i].service_url.host())); |
130 ServiceTreeNode* ns = new ServiceTreeNode(ASCIIToUTF16( | 130 ServiceTreeNode* ns = new ServiceTreeNode(ASCIIToUTF16( |
131 services[i].service_url.host())); | 131 services[i].service_url.host())); |
132 ns->SetServiceName(services[i].title); | 132 ns->SetServiceName(services[i].title); |
133 ns->SetServiceUrl(ASCIIToUTF16(services[i].service_url.spec())); | 133 ns->SetServiceUrl(ASCIIToUTF16(services[i].service_url.spec())); |
134 GURL icon_url = services[i].service_url.GetOrigin().Resolve("/favicon.ico"); | 134 GURL icon_url = services[i].service_url.GetOrigin().Resolve("/favicon.ico"); |
(...skipping 19 matching lines...) Expand all Loading... |
154 | 154 |
155 void WebIntentsModel::NotifyObserverEndBatch() { | 155 void WebIntentsModel::NotifyObserverEndBatch() { |
156 // Only notify the observers if this is the outermost call to EndBatch() if | 156 // Only notify the observers if this is the outermost call to EndBatch() if |
157 // called in a nested manner. | 157 // called in a nested manner. |
158 if (--batch_update_ == 0) { | 158 if (--batch_update_ == 0) { |
159 FOR_EACH_OBSERVER(Observer, | 159 FOR_EACH_OBSERVER(Observer, |
160 intents_observer_list_, | 160 intents_observer_list_, |
161 TreeModelEndBatch(this)); | 161 TreeModelEndBatch(this)); |
162 } | 162 } |
163 } | 163 } |
OLD | NEW |