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

Unified Diff: services/catalog/entry.cc

Issue 2645973006: [Service Manager] Get rid of dynamic service discovery (Closed)
Patch Set: . Created 3 years, 11 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/instance.h » ('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 83e9308dee227b39be4b69bae91250e9e72af9b5..3af447019ceb178e4ab28598b6ff7decc1983882 100644
--- a/services/catalog/entry.cc
+++ b/services/catalog/entry.cc
@@ -4,14 +4,21 @@
#include "services/catalog/entry.h"
+#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
+#include "base/path_service.h"
#include "base/values.h"
#include "services/catalog/store.h"
-
namespace catalog {
namespace {
+#if defined(OS_WIN)
+const char kServiceExecutableExtension[] = ".service.exe";
+#else
+const char kServiceExecutableExtension[] = ".service";
+#endif
+
bool ReadStringSet(const base::ListValue& list_value,
std::set<std::string>* string_set) {
DCHECK(string_set);
@@ -135,7 +142,12 @@ std::unique_ptr<base::DictionaryValue> Entry::Serialize() const {
}
// static
-std::unique_ptr<Entry> Entry::Deserialize(const base::DictionaryValue& value) {
+std::unique_ptr<Entry> Entry::Deserialize(const base::Value& manifest_root) {
+ const base::DictionaryValue* dictionary_value = nullptr;
+ if (!manifest_root.GetAsDictionary(&dictionary_value))
+ return nullptr;
+ const base::DictionaryValue& value = *dictionary_value;
+
auto entry = base::MakeUnique<Entry>();
// Name.
@@ -151,6 +163,13 @@ std::unique_ptr<Entry> Entry::Deserialize(const base::DictionaryValue& value) {
}
entry->set_name(name);
+ // By default we assume a standalone service executable. The catalog may
+ // override this layer based on configuration external to the service's own
+ // manifest.
+ base::FilePath module_path;
+ base::PathService::Get(base::DIR_MODULE, &module_path);
+ entry->set_path(module_path.AppendASCII(name + kServiceExecutableExtension));
+
// Human-readable name.
std::string display_name;
if (!value.GetString(Store::kDisplayNameKey, &display_name)) {
« no previous file with comments | « services/catalog/entry.h ('k') | services/catalog/instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698