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 |