Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: mojo/shell/public/cpp/capabilities.h

Issue 1775113003: Morph CapabilityFilter into caps::Capabilities, which supports capability classes (yet unimplemente… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@44cattests
Patch Set: . Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/shell/public/cpp/capabilities.h
diff --git a/mojo/shell/public/cpp/capabilities.h b/mojo/shell/public/cpp/capabilities.h
new file mode 100644
index 0000000000000000000000000000000000000000..3a01c3f66d1379303298143c6c7bca0371729770
--- /dev/null
+++ b/mojo/shell/public/cpp/capabilities.h
@@ -0,0 +1,64 @@
+// 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.
+
+#ifndef MOJO_SHELL_PUBLIC_CPP_CAPABILITIES_H_
+#define MOJO_SHELL_PUBLIC_CPP_CAPABILITIES_H_
+
+#include <map>
+#include <set>
+#include <string>
+
+#include "mojo/shell/public/interfaces/shell_resolver.mojom.h"
+
+namespace mojo {
+namespace caps {
sky 2016/03/09 21:33:16 The naming police wouldn't be happy with your use
+using Class = std::string;
+using Classes = std::set<std::string>;
+using Interface = std::string;
+using Interfaces = std::set<std::string>;
+using Name = std::string;
+
+// See comments in mojo/shell/public/interfaces/capabilities.mojom for a
+// description of CapabilityRequest and CapabilitySpec.
+
+struct CapabilityRequest {
+ Classes classes;
+ Interfaces interfaces;
+ bool operator==(const CapabilityRequest& other) const;
sky 2016/03/09 21:33:15 move above members (same comment for 34).
+};
+
+struct CapabilitySpec {
+ std::map<Class, Interfaces> provided;
+ std::map<Name, CapabilityRequest> required;
+ bool operator==(const CapabilitySpec& other) const;
+};
+
+} // namespace caps
+
+template <>
+struct TypeConverter<shell::mojom::CapabilitySpecPtr, caps::CapabilitySpec> {
+ static shell::mojom::CapabilitySpecPtr Convert(
+ const caps::CapabilitySpec& input);
+};
+template <>
+struct TypeConverter<caps::CapabilitySpec, shell::mojom::CapabilitySpecPtr> {
+ static caps::CapabilitySpec Convert(
+ const shell::mojom::CapabilitySpecPtr& input);
+};
+
+template <>
+struct TypeConverter<shell::mojom::CapabilityRequestPtr,
+ caps::CapabilityRequest> {
+ static shell::mojom::CapabilityRequestPtr Convert(
+ const caps::CapabilityRequest& input);
+};
+template <>
+struct TypeConverter<caps::CapabilityRequest,
+ shell::mojom::CapabilityRequestPtr> {
+ static caps::CapabilityRequest Convert(
+ const shell::mojom::CapabilityRequestPtr& input);
+};
+} // namespace mojo
+
+#endif // MOJO_SHELL_PUBLIC_CPP_CAPABILITIES_H_

Powered by Google App Engine
This is Rietveld 408576698