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

Unified Diff: mojo/shell/capability_filter.cc

Issue 1307273004: Group ConnectToApplication-related info into a params struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/capability_filter.h ('k') | mojo/shell/connect_to_application_params.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/capability_filter.cc
diff --git a/mojo/shell/capability_filter.cc b/mojo/shell/capability_filter.cc
index fa39449c50aac95d666c885338cf899f73a9c8ef..be595e0a827702f89f669e1d79c9b51cd5d733a9 100644
--- a/mojo/shell/capability_filter.cc
+++ b/mojo/shell/capability_filter.cc
@@ -4,6 +4,8 @@
#include "mojo/shell/capability_filter.h"
+#include "mojo/shell/identity.h"
+
namespace mojo {
namespace shell {
@@ -15,5 +17,21 @@ CapabilityFilter GetPermissiveCapabilityFilter() {
return filter;
}
+AllowedInterfaces GetAllowedInterfaces(const CapabilityFilter& filter,
+ const Identity& identity) {
+ // Start by looking for interfaces specific to the supplied identity.
+ auto it = filter.find(identity.url.spec());
+ if (it != filter.end())
+ return it->second;
+
+ // Fall back to looking for a wildcard rule.
+ it = filter.find("*");
+ if (filter.size() == 1 && it != filter.end())
+ return it->second;
+
+ // Finally, nothing is allowed.
+ return AllowedInterfaces();
+}
+
} // namespace shell
} // namespace mojo
« no previous file with comments | « mojo/shell/capability_filter.h ('k') | mojo/shell/connect_to_application_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698