Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2372)

Unified Diff: services/catalog/entry.cc

Issue 2684433003: Files required by a service now listed in manifest. (Closed)
Patch Set: Fix build. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/catalog/entry.h ('k') | services/catalog/entry_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/catalog/entry.cc
diff --git a/services/catalog/entry.cc b/services/catalog/entry.cc
index 3af447019ceb178e4ab28598b6ff7decc1983882..7db2026282d17269715a1b0a24649484209f68fb 100644
--- a/services/catalog/entry.cc
+++ b/services/catalog/entry.cc
@@ -8,6 +8,7 @@
#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/values.h"
+#include "services/catalog/public/cpp/manifest_parsing_util.h"
#include "services/catalog/store.h"
namespace catalog {
@@ -109,38 +110,6 @@ Entry::Entry(const std::string& name)
display_name_(name) {}
Entry::~Entry() {}
-std::unique_ptr<base::DictionaryValue> Entry::Serialize() const {
- auto value = base::MakeUnique<base::DictionaryValue>();
- value->SetString(Store::kNameKey, name_);
- value->SetString(Store::kDisplayNameKey, display_name_);
-
- auto specs = base::MakeUnique<base::DictionaryValue>();
- for (const auto& it : interface_provider_specs_) {
- auto spec = base::MakeUnique<base::DictionaryValue>();
-
- auto provides = base::MakeUnique<base::DictionaryValue>();
- for (const auto& i : it.second.provides) {
- auto interfaces = base::MakeUnique<base::ListValue>();
- for (const auto& interface_name : i.second)
- interfaces->AppendString(interface_name);
- provides->Set(i.first, std::move(interfaces));
- }
- spec->Set(Store::kInterfaceProviderSpecs_ProvidesKey, std::move(provides));
-
- auto requires = base::MakeUnique<base::DictionaryValue>();
- for (const auto& i : it.second.requires) {
- auto capabilities = base::MakeUnique<base::ListValue>();
- for (const auto& capability : i.second)
- capabilities->AppendString(capability);
- requires->Set(i.first, std::move(capabilities));
- }
- spec->Set(Store::kInterfaceProviderSpecs_RequiresKey, std::move(requires));
- specs->Set(it.first, std::move(spec));
- }
- value->Set(Store::kInterfaceProviderSpecsKey, std::move(specs));
- return value;
-}
-
// static
std::unique_ptr<Entry> Entry::Deserialize(const base::Value& manifest_root) {
const base::DictionaryValue* dictionary_value = nullptr;
@@ -206,6 +175,14 @@ std::unique_ptr<Entry> Entry::Deserialize(const base::Value& manifest_root) {
entry->AddInterfaceProviderSpec(it.key(), spec);
}
+ // Required files.
+ base::Optional<RequiredFileMap> required_files =
+ catalog::RetrieveRequiredFiles(value);
+ DCHECK(required_files);
+ for (const auto& iter : *required_files) {
+ entry->AddRequiredFilePath(iter.first, iter.second);
+ }
+
if (value.HasKey(Store::kServicesKey)) {
const base::ListValue* services = nullptr;
value.GetList(Store::kServicesKey, &services);
@@ -246,6 +223,11 @@ void Entry::AddInterfaceProviderSpec(
interface_provider_specs_[name] = spec;
}
+void Entry::AddRequiredFilePath(const std::string& name,
+ const base::FilePath& path) {
+ required_file_paths_[name] = path;
+}
+
} // catalog
namespace mojo {
« no previous file with comments | « services/catalog/entry.h ('k') | services/catalog/entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698