Chromium Code Reviews| 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 #ifndef SERVICES_CATALOG_ENTRY_H_ | 5 #ifndef SERVICES_CATALOG_ENTRY_H_ |
| 6 #define SERVICES_CATALOG_ENTRY_H_ | 6 #define SERVICES_CATALOG_ENTRY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "services/catalog/public/interfaces/catalog.mojom.h" | 14 #include "services/catalog/public/interfaces/catalog.mojom.h" |
| 15 #include "services/service_manager/public/cpp/interface_provider_spec.h" | 15 #include "services/service_manager/public/cpp/interface_provider_spec.h" |
| 16 #include "services/service_manager/public/interfaces/resolver.mojom.h" | 16 #include "services/service_manager/public/interfaces/resolver.mojom.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class DictionaryValue; | |
| 20 class Value; | 19 class Value; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace catalog { | 22 namespace catalog { |
| 24 | 23 |
| 25 // Static information about a service package known to the Catalog. | 24 // Static information about a service package known to the Catalog. |
| 26 class Entry { | 25 class Entry { |
| 27 public: | 26 public: |
| 28 Entry(); | 27 Entry(); |
| 29 explicit Entry(const std::string& name); | 28 explicit Entry(const std::string& name); |
| 30 ~Entry(); | 29 ~Entry(); |
| 31 | 30 |
| 32 std::unique_ptr<base::DictionaryValue> Serialize() const; | |
| 33 | |
| 34 static std::unique_ptr<Entry> Deserialize(const base::Value& manifest_root); | 31 static std::unique_ptr<Entry> Deserialize(const base::Value& manifest_root); |
| 35 | 32 |
| 36 bool ProvidesCapability(const std::string& capability) const; | 33 bool ProvidesCapability(const std::string& capability) const; |
| 37 | 34 |
| 38 bool operator==(const Entry& other) const; | 35 bool operator==(const Entry& other) const; |
| 39 | 36 |
| 40 const std::string& name() const { return name_; } | 37 const std::string& name() const { return name_; } |
| 41 void set_name(const std::string& name) { name_ = name; } | 38 void set_name(const std::string& name) { name_ = name; } |
| 42 | 39 |
| 43 const base::FilePath& path() const { return path_; } | 40 const base::FilePath& path() const { return path_; } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 60 } | 57 } |
| 61 | 58 |
| 62 void AddInterfaceProviderSpec( | 59 void AddInterfaceProviderSpec( |
| 63 const std::string& name, | 60 const std::string& name, |
| 64 const service_manager::InterfaceProviderSpec& spec); | 61 const service_manager::InterfaceProviderSpec& spec); |
| 65 const service_manager::InterfaceProviderSpecMap& | 62 const service_manager::InterfaceProviderSpecMap& |
| 66 interface_provider_specs() const { | 63 interface_provider_specs() const { |
| 67 return interface_provider_specs_; | 64 return interface_provider_specs_; |
| 68 } | 65 } |
| 69 | 66 |
| 67 void AddRequiredFileDescritor(const std::string& name, | |
|
dcheng
2017/02/15 08:05:27
Nit: AddRequiredFileDescriptor
Jay Civelli
2017/02/15 19:53:48
Renamed to AddRequiredFilePath.
| |
| 68 const std::string& path); | |
| 69 const std::map<std::string, std::string>& required_file_paths() const { | |
| 70 return required_file_paths_; | |
| 71 } | |
| 72 | |
| 70 private: | 73 private: |
| 71 std::string name_; | 74 std::string name_; |
| 72 base::FilePath path_; | 75 base::FilePath path_; |
| 73 std::string display_name_; | 76 std::string display_name_; |
| 74 service_manager::InterfaceProviderSpecMap interface_provider_specs_; | 77 service_manager::InterfaceProviderSpecMap interface_provider_specs_; |
| 78 std::map<std::string, std::string> required_file_paths_; | |
| 75 const Entry* parent_ = nullptr; | 79 const Entry* parent_ = nullptr; |
| 76 std::vector<std::unique_ptr<Entry>> children_; | 80 std::vector<std::unique_ptr<Entry>> children_; |
| 77 | 81 |
| 78 DISALLOW_COPY_AND_ASSIGN(Entry); | 82 DISALLOW_COPY_AND_ASSIGN(Entry); |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 } // namespace catalog | 85 } // namespace catalog |
| 82 | 86 |
| 83 namespace mojo { | 87 namespace mojo { |
| 84 template <> | 88 template <> |
| 85 struct TypeConverter<service_manager::mojom::ResolveResultPtr, | 89 struct TypeConverter<service_manager::mojom::ResolveResultPtr, |
| 86 const catalog::Entry*> { | 90 const catalog::Entry*> { |
| 87 static service_manager::mojom::ResolveResultPtr Convert( | 91 static service_manager::mojom::ResolveResultPtr Convert( |
| 88 const catalog::Entry* input); | 92 const catalog::Entry* input); |
| 89 }; | 93 }; |
| 90 | 94 |
| 91 template<> | 95 template<> |
| 92 struct TypeConverter<catalog::mojom::EntryPtr, catalog::Entry> { | 96 struct TypeConverter<catalog::mojom::EntryPtr, catalog::Entry> { |
| 93 static catalog::mojom::EntryPtr Convert(const catalog::Entry& input); | 97 static catalog::mojom::EntryPtr Convert(const catalog::Entry& input); |
| 94 }; | 98 }; |
| 95 | 99 |
| 96 } // namespace mojo | 100 } // namespace mojo |
| 97 | 101 |
| 98 #endif // SERVICES_CATALOG_ENTRY_H_ | 102 #endif // SERVICES_CATALOG_ENTRY_H_ |
| OLD | NEW |