| 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> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 explicit Entry(const std::string& name); | 27 explicit Entry(const std::string& name); |
| 28 ~Entry(); | 28 ~Entry(); |
| 29 | 29 |
| 30 std::unique_ptr<base::DictionaryValue> Serialize() const; | 30 std::unique_ptr<base::DictionaryValue> Serialize() const; |
| 31 | 31 |
| 32 // If the constructed Entry is a package that provides other Entrys, the | 32 // If the constructed Entry is a package that provides other Entrys, the |
| 33 // caller must assume ownership of the tree of Entrys by enumerating | 33 // caller must assume ownership of the tree of Entrys by enumerating |
| 34 // services(). | 34 // services(). |
| 35 static std::unique_ptr<Entry> Deserialize(const base::DictionaryValue& value); | 35 static std::unique_ptr<Entry> Deserialize(const base::DictionaryValue& value); |
| 36 | 36 |
| 37 bool ProvidesClass(const std::string& clazz) const; | 37 bool ProvidesCapability(const std::string& capability) const; |
| 38 | 38 |
| 39 bool operator==(const Entry& other) const; | 39 bool operator==(const Entry& other) const; |
| 40 bool operator<(const Entry& other) const; | |
| 41 | 40 |
| 42 const std::string& name() const { return name_; } | 41 const std::string& name() const { return name_; } |
| 43 void set_name(const std::string& name) { name_ = name; } | 42 void set_name(const std::string& name) { name_ = name; } |
| 44 const base::FilePath& path() const { return path_; } | 43 const base::FilePath& path() const { return path_; } |
| 45 void set_path(const base::FilePath& path) { path_ = path; } | 44 void set_path(const base::FilePath& path) { path_ = path; } |
| 46 const std::string& qualifier() const { return qualifier_; } | 45 const std::string& qualifier() const { return qualifier_; } |
| 47 void set_qualifier(const std::string& qualifier) { qualifier_ = qualifier; } | 46 void set_qualifier(const std::string& qualifier) { qualifier_ = qualifier; } |
| 48 const std::string& display_name() const { return display_name_; } | 47 const std::string& display_name() const { return display_name_; } |
| 49 void set_display_name(const std::string& display_name) { | 48 void set_display_name(const std::string& display_name) { |
| 50 display_name_ = display_name; | 49 display_name_ = display_name; |
| 51 } | 50 } |
| 52 const service_manager::InterfaceProviderSpec& connection_spec() const { | 51 void AddInterfaceProviderSpec( |
| 53 return connection_spec_; | 52 const std::string& name, |
| 54 } | 53 const service_manager::InterfaceProviderSpec& spec); |
| 55 void set_connection_spec( | 54 const service_manager::InterfaceProviderSpecMap& |
| 56 const service_manager::InterfaceProviderSpec& connection_spec) { | 55 interface_provider_specs() const { |
| 57 connection_spec_ = connection_spec; | 56 return interface_provider_specs_; |
| 58 } | 57 } |
| 59 const Entry* package() const { return package_; } | 58 const Entry* package() const { return package_; } |
| 60 void set_package(Entry* package) { package_ = package; } | 59 void set_package(Entry* package) { package_ = package; } |
| 61 | 60 |
| 62 std::vector<std::unique_ptr<Entry>> TakeChildren() { | 61 std::vector<std::unique_ptr<Entry>> TakeChildren() { |
| 63 return std::move(children_); | 62 return std::move(children_); |
| 64 } | 63 } |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 std::string name_; | 66 std::string name_; |
| 68 base::FilePath path_; | 67 base::FilePath path_; |
| 69 std::string qualifier_; | 68 std::string qualifier_; |
| 70 std::string display_name_; | 69 std::string display_name_; |
| 71 service_manager::InterfaceProviderSpec connection_spec_; | 70 service_manager::InterfaceProviderSpecMap interface_provider_specs_; |
| 72 Entry* package_ = nullptr; | 71 Entry* package_ = nullptr; |
| 73 std::vector<std::unique_ptr<Entry>> children_; | 72 std::vector<std::unique_ptr<Entry>> children_; |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace catalog | 75 } // namespace catalog |
| 77 | 76 |
| 78 namespace mojo { | 77 namespace mojo { |
| 79 template <> | 78 template <> |
| 80 struct TypeConverter<service_manager::mojom::ResolveResultPtr, catalog::Entry> { | 79 struct TypeConverter<service_manager::mojom::ResolveResultPtr, catalog::Entry> { |
| 81 static service_manager::mojom::ResolveResultPtr Convert( | 80 static service_manager::mojom::ResolveResultPtr Convert( |
| 82 const catalog::Entry& input); | 81 const catalog::Entry& input); |
| 83 }; | 82 }; |
| 84 | 83 |
| 85 template<> | 84 template<> |
| 86 struct TypeConverter<catalog::mojom::EntryPtr, catalog::Entry> { | 85 struct TypeConverter<catalog::mojom::EntryPtr, catalog::Entry> { |
| 87 static catalog::mojom::EntryPtr Convert(const catalog::Entry& input); | 86 static catalog::mojom::EntryPtr Convert(const catalog::Entry& input); |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 } // namespace mojo | 89 } // namespace mojo |
| 91 | 90 |
| 92 #endif // SERVICES_CATALOG_ENTRY_H_ | 91 #endif // SERVICES_CATALOG_ENTRY_H_ |
| OLD | NEW |