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

Side by Side Diff: mojo/shell/public/cpp/lib/capabilities.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
(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 #include "mojo/shell/public/cpp/capabilities.h"
6
7 namespace mojo {
8 namespace caps {
9
10 bool CapabilityRequest::operator==(const CapabilityRequest& other) const {
11 return other.classes == classes && other.interfaces == interfaces;
12 }
13
14 bool CapabilitySpec::operator==(const CapabilitySpec& other) const {
15 return other.provided == provided && other.required == required;
16 }
17
18 } // namespace caps
19
20 // static
21 shell::mojom::CapabilitySpecPtr
22 TypeConverter<shell::mojom::CapabilitySpecPtr, caps::CapabilitySpec>::Convert(
23 const caps::CapabilitySpec& input) {
24 shell::mojom::CapabilitySpecPtr spec(shell::mojom::CapabilitySpec::New());
25 spec->provided =
26 mojo::Map<mojo::String, mojo::Array<mojo::String>>::From(input.provided);
27 spec->required =
28 mojo::Map<mojo::String, shell::mojom::CapabilityRequestPtr>::From(
29 input.required);
30 return spec;
31 }
32
33 // static
34 caps::CapabilitySpec
35 TypeConverter<caps::CapabilitySpec, shell::mojom::CapabilitySpecPtr>::Convert(
36 const shell::mojom::CapabilitySpecPtr& input) {
37 caps::CapabilitySpec spec;
38 spec.provided = input->provided.To<std::map<caps::Class, caps::Interfaces>>();
39 spec.required =
40 input->required.To<std::map<caps::Name, caps::CapabilityRequest>>();
41 return spec;
42 }
43
44 // static
45 shell::mojom::CapabilityRequestPtr
46 TypeConverter<shell::mojom::CapabilityRequestPtr,
47 caps::CapabilityRequest>::Convert(
48 const caps::CapabilityRequest& input) {
49 shell::mojom::CapabilityRequestPtr request(
50 shell::mojom::CapabilityRequest::New());
51 request->classes = mojo::Array<mojo::String>::From(input.classes);
52 request->interfaces = mojo::Array<mojo::String>::From(input.interfaces);
53 return request;
54 }
55
56 // static
57 caps::CapabilityRequest
58 TypeConverter<caps::CapabilityRequest,
59 shell::mojom::CapabilityRequestPtr>::Convert(
60 const shell::mojom::CapabilityRequestPtr& input) {
61 caps::CapabilityRequest request;
62 request.classes = input->classes.To<std::set<std::string>>();
63 request.interfaces = input->interfaces.To<std::set<std::string>>();
64 return request;
65 }
66
67 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698