OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/catalog/entry.h" | 5 #include "services/catalog/entry.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "services/catalog/store.h" | 8 #include "services/catalog/store.h" |
9 #include "services/shell/public/cpp/names.h" | 9 #include "services/shell/public/cpp/names.h" |
10 | 10 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 224 } |
225 | 225 |
226 shell::CapabilitySpec spec; | 226 shell::CapabilitySpec spec; |
227 if (!BuildCapabilities(*capabilities, &spec)) { | 227 if (!BuildCapabilities(*capabilities, &spec)) { |
228 LOG(ERROR) << "Entry::Deserialize: failed to build capability spec for " | 228 LOG(ERROR) << "Entry::Deserialize: failed to build capability spec for " |
229 << entry->name(); | 229 << entry->name(); |
230 return nullptr; | 230 return nullptr; |
231 } | 231 } |
232 entry->set_capabilities(spec); | 232 entry->set_capabilities(spec); |
233 | 233 |
234 if (value.HasKey(Store::kApplicationsKey)) { | 234 if (value.HasKey(Store::kServicesKey)) { |
235 const base::ListValue* applications = nullptr; | 235 const base::ListValue* services = nullptr; |
236 value.GetList(Store::kApplicationsKey, &applications); | 236 value.GetList(Store::kServicesKey, &services); |
237 for (size_t i = 0; i < applications->GetSize(); ++i) { | 237 for (size_t i = 0; i < services->GetSize(); ++i) { |
238 const base::DictionaryValue* application = nullptr; | 238 const base::DictionaryValue* service = nullptr; |
239 applications->GetDictionary(i, &application); | 239 services->GetDictionary(i, &service); |
240 std::unique_ptr<Entry> child = Entry::Deserialize(*application); | 240 std::unique_ptr<Entry> child = Entry::Deserialize(*service); |
241 if (child) { | 241 if (child) { |
242 child->set_package(entry.get()); | 242 child->set_package(entry.get()); |
243 // Caller must assume ownership of these items. | 243 // Caller must assume ownership of these items. |
244 entry->applications_.insert(child.release()); | 244 entry->services_.insert(child.release()); |
245 } | 245 } |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 return entry; | 249 return entry; |
250 } | 250 } |
251 | 251 |
252 bool Entry::ProvidesClass(const std::string& clazz) const { | 252 bool Entry::ProvidesClass(const std::string& clazz) const { |
253 return capabilities_.provided.find(clazz) != capabilities_.provided.end(); | 253 return capabilities_.provided.find(clazz) != capabilities_.provided.end(); |
254 } | 254 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 catalog::mojom::EntryPtr | 288 catalog::mojom::EntryPtr |
289 TypeConverter<catalog::mojom::EntryPtr, catalog::Entry>::Convert( | 289 TypeConverter<catalog::mojom::EntryPtr, catalog::Entry>::Convert( |
290 const catalog::Entry& input) { | 290 const catalog::Entry& input) { |
291 catalog::mojom::EntryPtr result(catalog::mojom::Entry::New()); | 291 catalog::mojom::EntryPtr result(catalog::mojom::Entry::New()); |
292 result->name = input.name(); | 292 result->name = input.name(); |
293 result->display_name = input.display_name(); | 293 result->display_name = input.display_name(); |
294 return result; | 294 return result; |
295 } | 295 } |
296 | 296 |
297 } // namespace mojo | 297 } // namespace mojo |
OLD | NEW |