1 // Copyright 2015 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.
5 #include "mojo/shell/capability_filter.h"
7 #include "mojo/shell/identity.h"
12 CapabilityFilter
GetPermissiveCapabilityFilter() {
13 CapabilityFilter filter
;
14 AllowedInterfaces interfaces
;
15 interfaces
.insert("*");
16 filter
["*"] = interfaces
;
20 AllowedInterfaces
GetAllowedInterfaces(const CapabilityFilter
& filter
,
21 const Identity
& identity
) {
22 // Start by looking for interfaces specific to the supplied identity.
23 auto it
= filter
.find(identity
.url().spec());
24 if (it
!= filter
.end())
27 // Fall back to looking for a wildcard rule.
28 it
= filter
.find("*");
29 if (filter
.size() == 1 && it
!= filter
.end())
32 // Finally, nothing is allowed.
33 return AllowedInterfaces();