| OLD | NEW |
| 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/shell/public/cpp/capabilities.h" | 5 #include "mojo/shell/public/cpp/capabilities.h" |
| 6 | 6 |
| 7 namespace mojo { | 7 namespace mojo { |
| 8 | 8 |
| 9 CapabilityRequest::CapabilityRequest() {} | 9 CapabilityRequest::CapabilityRequest() {} |
| 10 CapabilityRequest::~CapabilityRequest() {} | 10 CapabilityRequest::~CapabilityRequest() {} |
| 11 | 11 |
| 12 bool CapabilityRequest::operator==(const CapabilityRequest& other) const { | 12 bool CapabilityRequest::operator==(const CapabilityRequest& other) const { |
| 13 return other.classes == classes && other.interfaces == interfaces; | 13 return other.classes == classes && other.interfaces == interfaces; |
| 14 } | 14 } |
| 15 | 15 |
| 16 bool CapabilityRequest::operator<(const CapabilityRequest& other) const { |
| 17 return std::tie(classes, interfaces) < |
| 18 std::tie(other.classes, other.interfaces); |
| 19 } |
| 20 |
| 16 CapabilitySpec::CapabilitySpec() {} | 21 CapabilitySpec::CapabilitySpec() {} |
| 17 CapabilitySpec::~CapabilitySpec() {} | 22 CapabilitySpec::~CapabilitySpec() {} |
| 18 | 23 |
| 19 bool CapabilitySpec::operator==(const CapabilitySpec& other) const { | 24 bool CapabilitySpec::operator==(const CapabilitySpec& other) const { |
| 20 return other.provided == provided && other.required == required; | 25 return other.provided == provided && other.required == required; |
| 21 } | 26 } |
| 22 | 27 |
| 28 bool CapabilitySpec::operator<(const CapabilitySpec& other) const { |
| 29 return std::tie(provided, required) < |
| 30 std::tie(other.provided, other.required); |
| 31 } |
| 32 |
| 23 // static | 33 // static |
| 24 shell::mojom::CapabilitySpecPtr | 34 shell::mojom::CapabilitySpecPtr |
| 25 TypeConverter<shell::mojom::CapabilitySpecPtr, CapabilitySpec>::Convert( | 35 TypeConverter<shell::mojom::CapabilitySpecPtr, CapabilitySpec>::Convert( |
| 26 const CapabilitySpec& input) { | 36 const CapabilitySpec& input) { |
| 27 shell::mojom::CapabilitySpecPtr spec(shell::mojom::CapabilitySpec::New()); | 37 shell::mojom::CapabilitySpecPtr spec(shell::mojom::CapabilitySpec::New()); |
| 28 spec->provided = | 38 spec->provided = |
| 29 mojo::Map<mojo::String, mojo::Array<mojo::String>>::From(input.provided); | 39 mojo::Map<mojo::String, mojo::Array<mojo::String>>::From(input.provided); |
| 30 spec->required = | 40 spec->required = |
| 31 mojo::Map<mojo::String, shell::mojom::CapabilityRequestPtr>::From( | 41 mojo::Map<mojo::String, shell::mojom::CapabilityRequestPtr>::From( |
| 32 input.required); | 42 input.required); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 61 TypeConverter<CapabilityRequest, | 71 TypeConverter<CapabilityRequest, |
| 62 shell::mojom::CapabilityRequestPtr>::Convert( | 72 shell::mojom::CapabilityRequestPtr>::Convert( |
| 63 const shell::mojom::CapabilityRequestPtr& input) { | 73 const shell::mojom::CapabilityRequestPtr& input) { |
| 64 CapabilityRequest request; | 74 CapabilityRequest request; |
| 65 request.classes = input->classes.To<std::set<std::string>>(); | 75 request.classes = input->classes.To<std::set<std::string>>(); |
| 66 request.interfaces = input->interfaces.To<std::set<std::string>>(); | 76 request.interfaces = input->interfaces.To<std::set<std::string>>(); |
| 67 return request; | 77 return request; |
| 68 } | 78 } |
| 69 | 79 |
| 70 } // namespace mojo | 80 } // namespace mojo |
| OLD | NEW |