blob: 3e4359268adcea1226145d989c96d0a40aa47560 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/macros.h"
#include "services/catalog/public/interfaces/catalog.mojom.h"
#include "services/service_manager/public/cpp/interface_provider_spec.h"
#include "services/service_manager/public/interfaces/resolver.mojom.h"
namespace base {
class DictionaryValue;
class Value;
namespace catalog {
// Static information about a service package known to the Catalog.
class Entry {
explicit Entry(const std::string& name);
std::unique_ptr<base::DictionaryValue> Serialize() const;
static std::unique_ptr<Entry> Deserialize(const base::Value& manifest_root);
bool ProvidesCapability(const std::string& capability) const;
bool operator==(const Entry& other) const;
const std::string& name() const { return name_; }
void set_name(const std::string& name) { name_ = name; }
const base::FilePath& path() const { return path_; }
void set_path(const base::FilePath& path) { path_ = path; }
const std::string& display_name() const { return display_name_; }
void set_display_name(const std::string& display_name) {
display_name_ = display_name;
const Entry* parent() const { return parent_; }
void set_parent(const Entry* parent) { parent_ = parent; }
const std::vector<std::unique_ptr<Entry>>& children() const {
return children_;
std::vector<std::unique_ptr<Entry>>& children() { return children_; }
void set_children(std::vector<std::unique_ptr<Entry>>&& children) {
children_ = std::move(children);
void AddInterfaceProviderSpec(
const std::string& name,
const service_manager::InterfaceProviderSpec& spec);
const service_manager::InterfaceProviderSpecMap&
interface_provider_specs() const {
return interface_provider_specs_;
std::string name_;
base::FilePath path_;
std::string display_name_;
service_manager::InterfaceProviderSpecMap interface_provider_specs_;
const Entry* parent_ = nullptr;
std::vector<std::unique_ptr<Entry>> children_;
} // namespace catalog
namespace mojo {
template <>
struct TypeConverter<service_manager::mojom::ResolveResultPtr,
const catalog::Entry*> {
static service_manager::mojom::ResolveResultPtr Convert(
const catalog::Entry* input);
struct TypeConverter<catalog::mojom::EntryPtr, catalog::Entry> {
static catalog::mojom::EntryPtr Convert(const catalog::Entry& input);
} // namespace mojo