| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 LOG(ERROR) << "Entry::Deserialize: " << Store::kCapabilities_RequiredKey | 91 LOG(ERROR) << "Entry::Deserialize: " << Store::kCapabilities_RequiredKey |
| 92 << " must be a dictionary."; | 92 << " must be a dictionary."; |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 if (!ReadStringSetFromDictionary( | 95 if (!ReadStringSetFromDictionary( |
| 96 *entry_value, Store::kCapabilities_ClassesKey, &spec.classes)) { | 96 *entry_value, Store::kCapabilities_ClassesKey, &spec.classes)) { |
| 97 LOG(ERROR) << "Entry::Deserialize: Invalid classes list in required " | 97 LOG(ERROR) << "Entry::Deserialize: Invalid classes list in required " |
| 98 << "capabilities dictionary."; | 98 << "capabilities dictionary."; |
| 99 return false; | 99 return false; |
| 100 } | 100 } |
| 101 shell::Interfaces interfaces; |
| 101 if (!ReadStringSetFromDictionary(*entry_value, | 102 if (!ReadStringSetFromDictionary(*entry_value, |
| 102 Store::kCapabilities_InterfacesKey, | 103 Store::kCapabilities_InterfacesKey, |
| 103 &spec.interfaces)) { | 104 &interfaces)) { |
| 104 LOG(ERROR) << "Entry::Deserialize: Invalid interfaces list in required " | 105 LOG(ERROR) << "Entry::Deserialize: Invalid interfaces list in required " |
| 105 << "capabilities dictionary."; | 106 << "capabilities dictionary."; |
| 106 return false; | 107 return false; |
| 107 } | 108 } |
| 109 if (interfaces.count("*") > 0) { |
| 110 LOG(ERROR) << "Entry::Deserializer: Wildcard not valid in interfaces " |
| 111 << "list."; |
| 112 return false; |
| 113 } |
| 114 spec.interfaces = interfaces; |
| 115 |
| 108 capabilities->required[it.key()] = spec; | 116 capabilities->required[it.key()] = spec; |
| 109 } | 117 } |
| 110 } | 118 } |
| 111 return true; | 119 return true; |
| 112 } | 120 } |
| 113 | 121 |
| 114 } // namespace | 122 } // namespace |
| 115 | 123 |
| 116 Entry::Entry() {} | 124 Entry::Entry() {} |
| 117 Entry::Entry(const std::string& name) | 125 Entry::Entry(const std::string& name) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 catalog::mojom::EntryPtr | 289 catalog::mojom::EntryPtr |
| 282 TypeConverter<catalog::mojom::EntryPtr, catalog::Entry>::Convert( | 290 TypeConverter<catalog::mojom::EntryPtr, catalog::Entry>::Convert( |
| 283 const catalog::Entry& input) { | 291 const catalog::Entry& input) { |
| 284 catalog::mojom::EntryPtr result(catalog::mojom::Entry::New()); | 292 catalog::mojom::EntryPtr result(catalog::mojom::Entry::New()); |
| 285 result->name = input.name(); | 293 result->name = input.name(); |
| 286 result->display_name = input.display_name(); | 294 result->display_name = input.display_name(); |
| 287 return result; | 295 return result; |
| 288 } | 296 } |
| 289 | 297 |
| 290 } // namespace mojo | 298 } // namespace mojo |
| OLD | NEW |