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