Chromium Code Reviews| 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 { | |
|
sky
2016/03/09 21:33:16
The naming police wouldn't be happy with your use
| |
| 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 // See comments in mojo/shell/public/interfaces/capabilities.mojom for a | |
| 23 // description of CapabilityRequest and CapabilitySpec. | |
| 24 | |
| 25 struct CapabilityRequest { | |
| 26 Classes classes; | |
| 27 Interfaces interfaces; | |
| 28 bool operator==(const CapabilityRequest& other) const; | |
|
sky
2016/03/09 21:33:15
move above members (same comment for 34).
| |
| 29 }; | |
| 30 | |
| 31 struct CapabilitySpec { | |
| 32 std::map<Class, Interfaces> provided; | |
| 33 std::map<Name, CapabilityRequest> required; | |
| 34 bool operator==(const CapabilitySpec& other) const; | |
| 35 }; | |
| 36 | |
| 37 } // namespace caps | |
| 38 | |
| 39 template <> | |
| 40 struct TypeConverter<shell::mojom::CapabilitySpecPtr, caps::CapabilitySpec> { | |
| 41 static shell::mojom::CapabilitySpecPtr Convert( | |
| 42 const caps::CapabilitySpec& input); | |
| 43 }; | |
| 44 template <> | |
| 45 struct TypeConverter<caps::CapabilitySpec, shell::mojom::CapabilitySpecPtr> { | |
| 46 static caps::CapabilitySpec Convert( | |
| 47 const shell::mojom::CapabilitySpecPtr& input); | |
| 48 }; | |
| 49 | |
| 50 template <> | |
| 51 struct TypeConverter<shell::mojom::CapabilityRequestPtr, | |
| 52 caps::CapabilityRequest> { | |
| 53 static shell::mojom::CapabilityRequestPtr Convert( | |
| 54 const caps::CapabilityRequest& input); | |
| 55 }; | |
| 56 template <> | |
| 57 struct TypeConverter<caps::CapabilityRequest, | |
| 58 shell::mojom::CapabilityRequestPtr> { | |
| 59 static caps::CapabilityRequest Convert( | |
| 60 const shell::mojom::CapabilityRequestPtr& input); | |
| 61 }; | |
| 62 } // namespace mojo | |
| 63 | |
| 64 #endif // MOJO_SHELL_PUBLIC_CPP_CAPABILITIES_H_ | |
| OLD | NEW |