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

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

Issue 2221153003: Establish MojoChildConnection from BrowserChildProcessHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-channel
Patch Set: rebase Created 4 years, 4 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 | « content/public/test/test_utils.cc ('k') | 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 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 <set>
10 #include <string> 9 #include <string>
10 #include <vector>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "services/catalog/public/interfaces/catalog.mojom.h" 13 #include "services/catalog/public/interfaces/catalog.mojom.h"
14 #include "services/shell/public/cpp/capabilities.h" 14 #include "services/shell/public/cpp/capabilities.h"
15 #include "services/shell/public/interfaces/resolver.mojom.h" 15 #include "services/shell/public/interfaces/resolver.mojom.h"
16 16
17 namespace base { 17 namespace base {
18 class DictionaryValue; 18 class DictionaryValue;
19 } 19 }
20 20
21 namespace catalog { 21 namespace catalog {
22 22
23 // Static information about a service package known to the Catalog. 23 // Static information about a service package known to the Catalog.
24 class Entry { 24 class Entry {
25 public: 25 public:
26 Entry(); 26 Entry();
27 explicit Entry(const std::string& name); 27 explicit Entry(const std::string& name);
28 explicit Entry(const Entry& other);
29 ~Entry(); 28 ~Entry();
30 29
31 std::unique_ptr<base::DictionaryValue> Serialize() const; 30 std::unique_ptr<base::DictionaryValue> Serialize() const;
32 31
33 // 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
34 // caller must assume ownership of the tree of Entrys by enumerating 33 // caller must assume ownership of the tree of Entrys by enumerating
35 // services(). 34 // services().
36 static std::unique_ptr<Entry> Deserialize(const base::DictionaryValue& value); 35 static std::unique_ptr<Entry> Deserialize(const base::DictionaryValue& value);
37 36
38 bool ProvidesClass(const std::string& clazz) const; 37 bool ProvidesClass(const std::string& clazz) const;
(...skipping 10 matching lines...) Expand all
49 const std::string& display_name() const { return display_name_; } 48 const std::string& display_name() const { return display_name_; }
50 void set_display_name(const std::string& display_name) { 49 void set_display_name(const std::string& display_name) {
51 display_name_ = display_name; 50 display_name_ = display_name;
52 } 51 }
53 const shell::CapabilitySpec& capabilities() const { return capabilities_; } 52 const shell::CapabilitySpec& capabilities() const { return capabilities_; }
54 void set_capabilities(const shell::CapabilitySpec& capabilities) { 53 void set_capabilities(const shell::CapabilitySpec& capabilities) {
55 capabilities_ = capabilities; 54 capabilities_ = capabilities;
56 } 55 }
57 const Entry* package() const { return package_; } 56 const Entry* package() const { return package_; }
58 void set_package(Entry* package) { package_ = package; } 57 void set_package(Entry* package) { package_ = package; }
59 const std::set<Entry*>& services() { return services_; } 58
59 std::vector<std::unique_ptr<Entry>> TakeChildren() {
60 return std::move(children_);
61 }
60 62
61 private: 63 private:
62 std::string name_; 64 std::string name_;
63 base::FilePath path_; 65 base::FilePath path_;
64 std::string qualifier_; 66 std::string qualifier_;
65 std::string display_name_; 67 std::string display_name_;
66 shell::CapabilitySpec capabilities_; 68 shell::CapabilitySpec capabilities_;
67 Entry* package_ = nullptr; 69 Entry* package_ = nullptr;
68 std::set<Entry*> services_; 70 std::vector<std::unique_ptr<Entry>> children_;
69 }; 71 };
70 72
71 } // namespace catalog 73 } // namespace catalog
72 74
73 namespace mojo { 75 namespace mojo {
74 template <> 76 template <>
75 struct TypeConverter<shell::mojom::ResolveResultPtr, catalog::Entry> { 77 struct TypeConverter<shell::mojom::ResolveResultPtr, catalog::Entry> {
76 static shell::mojom::ResolveResultPtr Convert(const catalog::Entry& input); 78 static shell::mojom::ResolveResultPtr Convert(const catalog::Entry& input);
77 }; 79 };
78 80
79 template<> 81 template<>
80 struct TypeConverter<catalog::mojom::EntryPtr, catalog::Entry> { 82 struct TypeConverter<catalog::mojom::EntryPtr, catalog::Entry> {
81 static catalog::mojom::EntryPtr Convert(const catalog::Entry& input); 83 static catalog::mojom::EntryPtr Convert(const catalog::Entry& input);
82 }; 84 };
83 85
84 } // namespace mojo 86 } // namespace mojo
85 87
86 #endif // SERVICES_CATALOG_ENTRY_H_ 88 #endif // SERVICES_CATALOG_ENTRY_H_
OLDNEW
« no previous file with comments | « content/public/test/test_utils.cc ('k') | services/catalog/entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698