// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "mojo/shell/public/cpp/capabilities.h" namespace mojo { CapabilityRequest::CapabilityRequest() {} CapabilityRequest::~CapabilityRequest() {} bool CapabilityRequest::operator==(const CapabilityRequest& other) const { return other.classes == classes && other.interfaces == interfaces; } bool CapabilityRequest::operator<(const CapabilityRequest& other) const { return std::tie(classes, interfaces) < std::tie(other.classes, other.interfaces); } CapabilitySpec::CapabilitySpec() {} CapabilitySpec::~CapabilitySpec() {} bool CapabilitySpec::operator==(const CapabilitySpec& other) const { return other.provided == provided && other.required == required; } bool CapabilitySpec::operator<(const CapabilitySpec& other) const { return std::tie(provided, required) < std::tie(other.provided, other.required); } // static shell::mojom::CapabilitySpecPtr TypeConverter::Convert( const CapabilitySpec& input) { shell::mojom::CapabilitySpecPtr spec(shell::mojom::CapabilitySpec::New()); spec->provided = mojo::Map>::From(input.provided); spec->required = mojo::Map::From( input.required); return spec; } // static CapabilitySpec TypeConverter::Convert( const shell::mojom::CapabilitySpecPtr& input) { CapabilitySpec spec; spec.provided = input->provided.To>(); spec.required = input->required.To>(); return spec; } // static shell::mojom::CapabilityRequestPtr TypeConverter::Convert( const CapabilityRequest& input) { shell::mojom::CapabilityRequestPtr request( shell::mojom::CapabilityRequest::New()); request->classes = mojo::Array::From(input.classes); request->interfaces = mojo::Array::From(input.interfaces); return request; } // static CapabilityRequest TypeConverter::Convert( const shell::mojom::CapabilityRequestPtr& input) { CapabilityRequest request; request.classes = input->classes.To>(); request.interfaces = input->interfaces.To>(); return request; } } // namespace mojo