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

Side by Side Diff: services/catalog/instance.cc

Issue 2425563004: Support reading multiple InterfaceProviderSpecs from manifests (Closed)
Patch Set: . Created 4 years, 1 month 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 | « services/catalog/instance.h ('k') | services/catalog/public/interfaces/catalog.mojom » ('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 #include "services/catalog/instance.h" 5 #include "services/catalog/instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "services/catalog/entry.h" 8 #include "services/catalog/entry.h"
9 #include "services/catalog/manifest_provider.h" 9 #include "services/catalog/manifest_provider.h"
10 #include "services/catalog/reader.h" 10 #include "services/catalog/reader.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void Instance::ResolveMojoName(const std::string& mojo_name, 61 void Instance::ResolveMojoName(const std::string& mojo_name,
62 const ResolveMojoNameCallback& callback) { 62 const ResolveMojoNameCallback& callback) {
63 DCHECK(system_cache_); 63 DCHECK(system_cache_);
64 64
65 std::string type = service_manager::GetNameType(mojo_name); 65 std::string type = service_manager::GetNameType(mojo_name);
66 if (type != service_manager::kNameType_Service && 66 if (type != service_manager::kNameType_Service &&
67 type != service_manager::kNameType_Exe) { 67 type != service_manager::kNameType_Exe) {
68 std::unique_ptr<Entry> entry(new Entry(mojo_name)); 68 std::unique_ptr<Entry> entry(new Entry(mojo_name));
69 service_manager::mojom::ResolveResultPtr result = 69 service_manager::mojom::ResolveResultPtr result =
70 service_manager::mojom::ResolveResult::From(*entry); 70 service_manager::mojom::ResolveResult::From(*entry);
71 result->connection_spec = base::nullopt;
72 callback.Run(std::move(result)); 71 callback.Run(std::move(result));
73 return; 72 return;
74 } 73 }
75 74
76 // TODO(beng): per-user catalogs. 75 // TODO(beng): per-user catalogs.
77 auto entry = system_cache_->find(mojo_name); 76 auto entry = system_cache_->find(mojo_name);
78 if (entry != system_cache_->end()) { 77 if (entry != system_cache_->end()) {
79 callback.Run(service_manager::mojom::ResolveResult::From(*entry->second)); 78 callback.Run(service_manager::mojom::ResolveResult::From(*entry->second));
80 return; 79 return;
81 } 80 }
(...skipping 25 matching lines...) Expand all
107 if (system_cache_->find(name) != system_cache_->end()) 106 if (system_cache_->find(name) != system_cache_->end())
108 entry = (*system_cache_)[name].get(); 107 entry = (*system_cache_)[name].get();
109 else 108 else
110 continue; 109 continue;
111 AddEntry(*entry, &entries); 110 AddEntry(*entry, &entries);
112 } 111 }
113 } 112 }
114 callback.Run(std::move(entries)); 113 callback.Run(std::move(entries));
115 } 114 }
116 115
117 void Instance::GetEntriesProvidingClass( 116 void Instance::GetEntriesProvidingCapability(
118 const std::string& clazz, 117 const std::string& capability,
119 const GetEntriesProvidingClassCallback& callback) { 118 const GetEntriesProvidingCapabilityCallback& callback) {
120 std::vector<mojom::EntryPtr> entries; 119 std::vector<mojom::EntryPtr> entries;
121 for (const auto& entry : *system_cache_) 120 for (const auto& entry : *system_cache_)
122 if (entry.second->ProvidesClass(clazz)) 121 if (entry.second->ProvidesCapability(capability))
123 entries.push_back(mojom::Entry::From(*entry.second)); 122 entries.push_back(mojom::Entry::From(*entry.second));
124 callback.Run(std::move(entries)); 123 callback.Run(std::move(entries));
125 } 124 }
126 125
127 void Instance::GetEntriesConsumingMIMEType( 126 void Instance::GetEntriesConsumingMIMEType(
128 const std::string& mime_type, 127 const std::string& mime_type,
129 const GetEntriesConsumingMIMETypeCallback& callback) { 128 const GetEntriesConsumingMIMETypeCallback& callback) {
130 // TODO(beng): implement. 129 // TODO(beng): implement.
131 } 130 }
132 131
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void Instance::OnReadManifest(base::WeakPtr<Instance> instance, 170 void Instance::OnReadManifest(base::WeakPtr<Instance> instance,
172 const std::string& mojo_name, 171 const std::string& mojo_name,
173 const ResolveMojoNameCallback& callback, 172 const ResolveMojoNameCallback& callback,
174 service_manager::mojom::ResolveResultPtr result) { 173 service_manager::mojom::ResolveResultPtr result) {
175 callback.Run(std::move(result)); 174 callback.Run(std::move(result));
176 if (instance) 175 if (instance)
177 instance->SerializeCatalog(); 176 instance->SerializeCatalog();
178 } 177 }
179 178
180 } // namespace catalog 179 } // namespace catalog
OLDNEW
« no previous file with comments | « services/catalog/instance.h ('k') | services/catalog/public/interfaces/catalog.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698