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