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

Unified Diff: services/catalog/entry.cc

Issue 2684433003: Files required by a service now listed in manifest. (Closed)
Patch Set: Removed unused method in apk_assets 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
Index: services/catalog/entry.cc
diff --git a/services/catalog/entry.cc b/services/catalog/entry.cc
index 3af447019ceb178e4ab28598b6ff7decc1983882..5550932c9593ea2e26032bee2c7d2fb75d4235a7 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,13 @@ std::unique_ptr<Entry> Entry::Deserialize(const base::Value& manifest_root) {
entry->AddInterfaceProviderSpec(it.key(), spec);
}
+ // Required files.
+ RequiredFileMap required_files;
+ catalog::PopulateRequiredFiles(value, &required_files);
+ for (const auto& iter : required_files) {
+ entry->AddRequiredFileDescritor(iter.first, iter.second);
dcheng 2017/02/15 08:05:27 The naming also feels a little unusual: there's no
Jay Civelli 2017/02/15 19:53:47 You are right, especially since everything else us
+ }
+
if (value.HasKey(Store::kServicesKey)) {
const base::ListValue* services = nullptr;
value.GetList(Store::kServicesKey, &services);
@@ -246,6 +222,11 @@ void Entry::AddInterfaceProviderSpec(
interface_provider_specs_[name] = spec;
}
+void Entry::AddRequiredFileDescritor(const std::string& name,
+ const std::string& path) {
+ required_file_paths_[name] = path;
+}
+
} // catalog
namespace mojo {

Powered by Google App Engine
This is Rietveld 408576698