| 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 using Class = std::string; |
| 16 using Classes = std::set<std::string>; |
| 17 using Interface = std::string; |
| 18 using Interfaces = std::set<std::string>; |
| 19 using Name = std::string; |
| 20 |
| 21 // See comments in mojo/shell/public/interfaces/capabilities.mojom for a |
| 22 // description of CapabilityRequest and CapabilitySpec. |
| 23 |
| 24 struct CapabilityRequest { |
| 25 CapabilityRequest(); |
| 26 ~CapabilityRequest(); |
| 27 bool operator==(const CapabilityRequest& other) const; |
| 28 Classes classes; |
| 29 Interfaces interfaces; |
| 30 }; |
| 31 |
| 32 struct CapabilitySpec { |
| 33 CapabilitySpec(); |
| 34 ~CapabilitySpec(); |
| 35 bool operator==(const CapabilitySpec& other) const; |
| 36 std::map<Class, Interfaces> provided; |
| 37 std::map<Name, CapabilityRequest> required; |
| 38 }; |
| 39 |
| 40 template <> |
| 41 struct TypeConverter<shell::mojom::CapabilitySpecPtr, CapabilitySpec> { |
| 42 static shell::mojom::CapabilitySpecPtr Convert( |
| 43 const CapabilitySpec& input); |
| 44 }; |
| 45 template <> |
| 46 struct TypeConverter<CapabilitySpec, shell::mojom::CapabilitySpecPtr> { |
| 47 static CapabilitySpec Convert( |
| 48 const shell::mojom::CapabilitySpecPtr& input); |
| 49 }; |
| 50 |
| 51 template <> |
| 52 struct TypeConverter<shell::mojom::CapabilityRequestPtr, |
| 53 CapabilityRequest> { |
| 54 static shell::mojom::CapabilityRequestPtr Convert( |
| 55 const CapabilityRequest& input); |
| 56 }; |
| 57 template <> |
| 58 struct TypeConverter<CapabilityRequest, |
| 59 shell::mojom::CapabilityRequestPtr> { |
| 60 static CapabilityRequest Convert( |
| 61 const shell::mojom::CapabilityRequestPtr& input); |
| 62 }; |
| 63 } // namespace mojo |
| 64 |
| 65 #endif // MOJO_SHELL_PUBLIC_CPP_CAPABILITIES_H_ |
| OLD | NEW |