| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_SERVICES_CATALOG_ENTRY_H_ | |
| 6 #define MOJO_SERVICES_CATALOG_ENTRY_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/files/file_path.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "services/shell/public/cpp/capabilities.h" | |
| 14 | |
| 15 namespace base { | |
| 16 class DictionaryValue; | |
| 17 } | |
| 18 | |
| 19 namespace catalog { | |
| 20 | |
| 21 // Static information about an application package known to the Catalog. | |
| 22 class Entry { | |
| 23 public: | |
| 24 Entry(); | |
| 25 explicit Entry(const std::string& name); | |
| 26 explicit Entry(const Entry& other); | |
| 27 ~Entry(); | |
| 28 | |
| 29 scoped_ptr<base::DictionaryValue> Serialize() const; | |
| 30 | |
| 31 // If the constructed Entry is a package that provides other Entrys, the | |
| 32 // caller must assume ownership of the tree of Entrys by enumerating | |
| 33 // applications(). | |
| 34 static scoped_ptr<Entry> Deserialize(const base::DictionaryValue& value); | |
| 35 | |
| 36 bool operator==(const Entry& other) const; | |
| 37 bool operator<(const Entry& other) const; | |
| 38 | |
| 39 const std::string& name() const { return name_; } | |
| 40 void set_name(const std::string& name) { name_ = name; } | |
| 41 const base::FilePath& path() const { return path_; } | |
| 42 void set_path(const base::FilePath& path) { path_ = path; } | |
| 43 const std::string& qualifier() const { return qualifier_; } | |
| 44 void set_qualifier(const std::string& qualifier) { qualifier_ = qualifier; } | |
| 45 const std::string& display_name() const { return display_name_; } | |
| 46 void set_display_name(const std::string& display_name) { | |
| 47 display_name_ = display_name; | |
| 48 } | |
| 49 const mojo::CapabilitySpec& capabilities() const { return capabilities_; } | |
| 50 void set_capabilities(const mojo::CapabilitySpec& capabilities) { | |
| 51 capabilities_ = capabilities; | |
| 52 } | |
| 53 const Entry* package() const { return package_; } | |
| 54 void set_package(Entry* package) { package_ = package; } | |
| 55 const std::set<Entry*>& applications() { return applications_; } | |
| 56 | |
| 57 private: | |
| 58 std::string name_; | |
| 59 base::FilePath path_; | |
| 60 std::string qualifier_; | |
| 61 std::string display_name_; | |
| 62 mojo::CapabilitySpec capabilities_; | |
| 63 Entry* package_ = nullptr; | |
| 64 std::set<Entry*> applications_; | |
| 65 }; | |
| 66 | |
| 67 } // namespace catalog | |
| 68 | |
| 69 namespace mojo { | |
| 70 template <> | |
| 71 struct TypeConverter<shell::mojom::ResolveResultPtr, catalog::Entry> { | |
| 72 static shell::mojom::ResolveResultPtr Convert(const catalog::Entry& input); | |
| 73 }; | |
| 74 } | |
| 75 | |
| 76 #endif // MOJO_SERVICES_CATALOG_ENTRY_H_ | |
| OLD | NEW |