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

Unified Diff: mojo/shell/public/cpp/lib/capabilities.cc

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
« no previous file with comments | « mojo/shell/public/cpp/lib/application_test_base.cc ('k') | mojo/shell/public/cpp/lib/shell_connection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/public/cpp/lib/capabilities.cc
diff --git a/mojo/shell/public/cpp/lib/capabilities.cc b/mojo/shell/public/cpp/lib/capabilities.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cc3fc1801941e4247f72af77f56bbacd268a16b7
--- /dev/null
+++ b/mojo/shell/public/cpp/lib/capabilities.cc
@@ -0,0 +1,70 @@
+// 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;
+}
+
+CapabilitySpec::CapabilitySpec() {}
+CapabilitySpec::~CapabilitySpec() {}
+
+bool CapabilitySpec::operator==(const CapabilitySpec& other) const {
+ return other.provided == provided && other.required == required;
+}
+
+// static
+shell::mojom::CapabilitySpecPtr
+TypeConverter<shell::mojom::CapabilitySpecPtr, CapabilitySpec>::Convert(
+ const CapabilitySpec& input) {
+ shell::mojom::CapabilitySpecPtr spec(shell::mojom::CapabilitySpec::New());
+ spec->provided =
+ mojo::Map<mojo::String, mojo::Array<mojo::String>>::From(input.provided);
+ spec->required =
+ mojo::Map<mojo::String, shell::mojom::CapabilityRequestPtr>::From(
+ input.required);
+ return spec;
+}
+
+// static
+CapabilitySpec
+TypeConverter<CapabilitySpec, shell::mojom::CapabilitySpecPtr>::Convert(
+ const shell::mojom::CapabilitySpecPtr& input) {
+ CapabilitySpec spec;
+ spec.provided = input->provided.To<std::map<Class, Interfaces>>();
+ spec.required =
+ input->required.To<std::map<Name, CapabilityRequest>>();
+ return spec;
+}
+
+// static
+shell::mojom::CapabilityRequestPtr
+TypeConverter<shell::mojom::CapabilityRequestPtr,
+ CapabilityRequest>::Convert(
+ const CapabilityRequest& input) {
+ shell::mojom::CapabilityRequestPtr request(
+ shell::mojom::CapabilityRequest::New());
+ request->classes = mojo::Array<mojo::String>::From(input.classes);
+ request->interfaces = mojo::Array<mojo::String>::From(input.interfaces);
+ return request;
+}
+
+// static
+CapabilityRequest
+TypeConverter<CapabilityRequest,
+ shell::mojom::CapabilityRequestPtr>::Convert(
+ const shell::mojom::CapabilityRequestPtr& input) {
+ CapabilityRequest request;
+ request.classes = input->classes.To<std::set<std::string>>();
+ request.interfaces = input->interfaces.To<std::set<std::string>>();
+ return request;
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/shell/public/cpp/lib/application_test_base.cc ('k') | mojo/shell/public/cpp/lib/shell_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698