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

Side by Side Diff: mojo/services/catalog/entry.h

Issue 1828803002: Simplify resolve. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@61catalog
Patch Set: . Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « mojo/services/catalog/catalog.cc ('k') | mojo/services/catalog/entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 MOJO_SERVICES_CATALOG_ENTRY_H_ 5 #ifndef MOJO_SERVICES_CATALOG_ENTRY_H_
6 #define MOJO_SERVICES_CATALOG_ENTRY_H_ 6 #define MOJO_SERVICES_CATALOG_ENTRY_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "mojo/shell/public/cpp/capabilities.h" 13 #include "mojo/shell/public/cpp/capabilities.h"
13 14
14 namespace base { 15 namespace base {
15 class DictionaryValue; 16 class DictionaryValue;
16 } 17 }
17 18
18 namespace catalog { 19 namespace catalog {
19 20
20 // Static information about an application package known to the Catalog. 21 // Static information about an application package known to the Catalog.
21 class Entry { 22 class Entry {
22 public: 23 public:
23 Entry(); 24 Entry();
25 explicit Entry(const std::string& name);
24 explicit Entry(const Entry& other); 26 explicit Entry(const Entry& other);
25 ~Entry(); 27 ~Entry();
26 28
27 scoped_ptr<base::DictionaryValue> Serialize() const; 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().
28 static scoped_ptr<Entry> Deserialize(const base::DictionaryValue& value); 34 static scoped_ptr<Entry> Deserialize(const base::DictionaryValue& value);
29 35
30 bool operator==(const Entry& other) const; 36 bool operator==(const Entry& other) const;
31 bool operator<(const Entry& other) const; 37 bool operator<(const Entry& other) const;
32 38
33 const std::string& name() const { return name_; } 39 const std::string& name() const { return name_; }
34 void set_name(const std::string& name) { name_ = 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; }
35 const std::string& qualifier() const { return qualifier_; } 43 const std::string& qualifier() const { return qualifier_; }
36 void set_qualifier(const std::string& qualifier) { qualifier_ = qualifier; } 44 void set_qualifier(const std::string& qualifier) { qualifier_ = qualifier; }
37 const std::string& display_name() const { return display_name_; } 45 const std::string& display_name() const { return display_name_; }
38 void set_display_name(const std::string& display_name) { 46 void set_display_name(const std::string& display_name) {
39 display_name_ = display_name; 47 display_name_ = display_name;
40 } 48 }
41 const mojo::CapabilitySpec& capabilities() const { return capabilities_; } 49 const mojo::CapabilitySpec& capabilities() const { return capabilities_; }
42 void set_capabilities(const mojo::CapabilitySpec& capabilities) { 50 void set_capabilities(const mojo::CapabilitySpec& capabilities) {
43 capabilities_ = capabilities; 51 capabilities_ = capabilities;
44 } 52 }
45 const std::set<Entry>& applications() { return applications_; } 53 const Entry* package() const { return package_; }
54 void set_package(Entry* package) { package_ = package; }
55 const std::set<Entry*>& applications() { return applications_; }
46 56
47 private: 57 private:
48 std::string name_; 58 std::string name_;
59 base::FilePath path_;
49 std::string qualifier_; 60 std::string qualifier_;
50 std::string display_name_; 61 std::string display_name_;
51 mojo::CapabilitySpec capabilities_; 62 mojo::CapabilitySpec capabilities_;
52 std::set<Entry> applications_; 63 Entry* package_ = nullptr;
64 std::set<Entry*> applications_;
53 }; 65 };
54 66
55 } // namespace catalog 67 } // namespace catalog
56 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
57 #endif // MOJO_SERVICES_CATALOG_ENTRY_H_ 76 #endif // MOJO_SERVICES_CATALOG_ENTRY_H_
OLDNEW
« no previous file with comments | « mojo/services/catalog/catalog.cc ('k') | mojo/services/catalog/entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698