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

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

Issue 1775113003: Morph CapabilityFilter into caps::Capabilities, which supports capability classes (yet unimplemente… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@44cattests
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
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 "mojo/services/catalog/catalog.h" 5 #include "mojo/services/catalog/catalog.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } else if (type == "exe") { 141 } else if (type == "exe") {
142 #if defined OS_WIN 142 #if defined OS_WIN
143 std::string extension = ".exe"; 143 std::string extension = ".exe";
144 #else 144 #else
145 std::string extension; 145 std::string extension;
146 #endif 146 #endif
147 file_url = system_package_dir_.Resolve( 147 file_url = system_package_dir_.Resolve(
148 mojo::GetNamePath(resolved_name) + extension); 148 mojo::GetNamePath(resolved_name) + extension);
149 } 149 }
150 150
151 mojo::shell::mojom::CapabilityFilterPtr filter( 151 mojo::shell::mojom::CapabilitySpecPtr capabilities_ptr =
152 mojo::shell::mojom::CapabilityFilter::New()); 152 mojo::shell::mojom::CapabilitySpec::From(entry_iter->second.capabilities);
153 filter->filter = mojo::Map<mojo::String, mojo::Array<mojo::String>>(); 153
154 for (const auto& entry : entry_iter->second.capabilities) { 154 callback.Run(resolved_name, qualifier, std::move(capabilities_ptr),
155 mojo::Array<mojo::String> interfaces;
156 for (auto interface_name : entry.second)
157 interfaces.push_back(interface_name);
158 filter->filter.insert(entry.first, std::move(interfaces));
159 }
160 callback.Run(resolved_name, qualifier, std::move(filter),
161 file_url.spec()); 155 file_url.spec());
162 } 156 }
163 157
164 bool Catalog::IsNameInCatalog(const std::string& name) const { 158 bool Catalog::IsNameInCatalog(const std::string& name) const {
165 return catalog_.find(name) != catalog_.end(); 159 return catalog_.find(name) != catalog_.end();
166 } 160 }
167 161
168 void Catalog::AddNameToCatalog(const std::string& name, 162 void Catalog::AddNameToCatalog(const std::string& name,
169 const ResolveMojoNameCallback& callback) { 163 const ResolveMojoNameCallback& callback) {
170 GURL manifest_url = GetManifestURL(name); 164 GURL manifest_url = GetManifestURL(name);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 269 }
276 SerializeCatalog(); 270 SerializeCatalog();
277 271
278 auto qualifier_iter = qualifiers_.find(name); 272 auto qualifier_iter = qualifiers_.find(name);
279 DCHECK(qualifier_iter != qualifiers_.end()); 273 DCHECK(qualifier_iter != qualifiers_.end());
280 std::string qualifier = qualifier_iter->second; 274 std::string qualifier = qualifier_iter->second;
281 CompleteResolveMojoName(name, qualifier, callback); 275 CompleteResolveMojoName(name, qualifier, callback);
282 } 276 }
283 277
284 } // namespace catalog 278 } // namespace catalog
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698