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

Side by Side Diff: mojo/shell/public/cpp/lib/capabilities.cc

Issue 1877753003: Move mojo\shell to services\shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@62scan
Patch Set: . Created 4 years, 8 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
9 CapabilityRequest::CapabilityRequest() {}
10 CapabilityRequest::CapabilityRequest(const CapabilityRequest& other) = default;
11 CapabilityRequest::~CapabilityRequest() {}
12
13 bool CapabilityRequest::operator==(const CapabilityRequest& other) const {
14 return other.classes == classes && other.interfaces == interfaces;
15 }
16
17 bool CapabilityRequest::operator<(const CapabilityRequest& other) const {
18 return std::tie(classes, interfaces) <
19 std::tie(other.classes, other.interfaces);
20 }
21
22 CapabilitySpec::CapabilitySpec() {}
23 CapabilitySpec::CapabilitySpec(const CapabilitySpec& other) = default;
24 CapabilitySpec::~CapabilitySpec() {}
25
26 bool CapabilitySpec::operator==(const CapabilitySpec& other) const {
27 return other.provided == provided && other.required == required;
28 }
29
30 bool CapabilitySpec::operator<(const CapabilitySpec& other) const {
31 return std::tie(provided, required) <
32 std::tie(other.provided, other.required);
33 }
34
35 // static
36 shell::mojom::CapabilitySpecPtr
37 TypeConverter<shell::mojom::CapabilitySpecPtr, CapabilitySpec>::Convert(
38 const CapabilitySpec& input) {
39 shell::mojom::CapabilitySpecPtr spec(shell::mojom::CapabilitySpec::New());
40 spec->provided =
41 mojo::Map<mojo::String, mojo::Array<mojo::String>>::From(input.provided);
42 spec->required =
43 mojo::Map<mojo::String, shell::mojom::CapabilityRequestPtr>::From(
44 input.required);
45 return spec;
46 }
47
48 // static
49 CapabilitySpec
50 TypeConverter<CapabilitySpec, shell::mojom::CapabilitySpecPtr>::Convert(
51 const shell::mojom::CapabilitySpecPtr& input) {
52 CapabilitySpec spec;
53 spec.provided = input->provided.To<std::map<Class, Interfaces>>();
54 spec.required =
55 input->required.To<std::map<Name, CapabilityRequest>>();
56 return spec;
57 }
58
59 // static
60 shell::mojom::CapabilityRequestPtr
61 TypeConverter<shell::mojom::CapabilityRequestPtr,
62 CapabilityRequest>::Convert(
63 const CapabilityRequest& input) {
64 shell::mojom::CapabilityRequestPtr request(
65 shell::mojom::CapabilityRequest::New());
66 request->classes = mojo::Array<mojo::String>::From(input.classes);
67 request->interfaces = mojo::Array<mojo::String>::From(input.interfaces);
68 return request;
69 }
70
71 // static
72 CapabilityRequest
73 TypeConverter<CapabilityRequest,
74 shell::mojom::CapabilityRequestPtr>::Convert(
75 const shell::mojom::CapabilityRequestPtr& input) {
76 CapabilityRequest request;
77 request.classes = input->classes.To<std::set<std::string>>();
78 request.interfaces = input->interfaces.To<std::set<std::string>>();
79 return request;
80 }
81
82 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/lib/application_test_main.cc ('k') | mojo/shell/public/cpp/lib/connection_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698