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 #ifndef MOJO_SHELL_PUBLIC_CPP_CAPABILITIES_H_ |
| 6 #define MOJO_SHELL_PUBLIC_CPP_CAPABILITIES_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <set> |
| 10 #include <string> |
| 11 |
| 12 #include "mojo/shell/public/interfaces/shell_resolver.mojom.h" |
| 13 |
| 14 namespace mojo { |
| 15 namespace caps { |
| 16 using Class = std::string; |
| 17 using Classes = std::set<std::string>; |
| 18 using Interface = std::string; |
| 19 using Interfaces = std::set<std::string>; |
| 20 using Name = std::string; |
| 21 |
| 22 struct CapabilitySpec { |
| 23 Classes classes; |
| 24 Interfaces interfaces; |
| 25 }; |
| 26 |
| 27 struct Capabilities { |
| 28 std::map<Class, Interfaces> provided; |
| 29 std::map<Name, CapabilitySpec> required; |
| 30 }; |
| 31 |
| 32 } // namespace caps |
| 33 |
| 34 template <> |
| 35 struct TypeConverter<shell::mojom::CapabilitiesPtr, caps::Capabilities> { |
| 36 static shell::mojom::CapabilitiesPtr Convert(const caps::Capabilities& input); |
| 37 }; |
| 38 template <> |
| 39 struct TypeConverter<caps::Capabilities, shell::mojom::CapabilitiesPtr> { |
| 40 static caps::Capabilities Convert(const shell::mojom::CapabilitiesPtr& input); |
| 41 }; |
| 42 |
| 43 template <> |
| 44 struct TypeConverter<shell::mojom::CapabilitySpecPtr, caps::CapabilitySpec> { |
| 45 static shell::mojom::CapabilitySpecPtr Convert( |
| 46 const caps::CapabilitySpec& input); |
| 47 }; |
| 48 template <> |
| 49 struct TypeConverter<caps::CapabilitySpec, shell::mojom::CapabilitySpecPtr> { |
| 50 static caps::CapabilitySpec Convert( |
| 51 const shell::mojom::CapabilitySpecPtr& input); |
| 52 }; |
| 53 } // namespace mojo |
| 54 |
| 55 #endif // MOJO_SHELL_PUBLIC_CPP_CAPABILITIES_H_ |
OLD | NEW |