Index: mojo/shell/identity.cc |
diff --git a/mojo/shell/identity.cc b/mojo/shell/identity.cc |
deleted file mode 100644 |
index 243565a91f4650685859a15c2d35b8db948dcadb..0000000000000000000000000000000000000000 |
--- a/mojo/shell/identity.cc |
+++ /dev/null |
@@ -1,78 +0,0 @@ |
-// Copyright 2015 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/identity.h" |
- |
-#include "mojo/shell/public/cpp/names.h" |
-#include "mojo/shell/public/interfaces/connector.mojom.h" |
- |
-namespace mojo { |
-namespace shell { |
- |
-Identity::Identity() {} |
- |
-Identity::Identity(const std::string& name) |
- : Identity(name, GetNamePath(name), mojom::kRootUserID) {} |
- |
-Identity::Identity(const std::string& name, const std::string& qualifier, |
- const std::string& user_id) |
- : name_(name), |
- qualifier_(qualifier.empty() ? GetNamePath(name_) : qualifier), |
- user_id_(user_id) {} |
- |
-Identity::Identity(const Identity& other) = default; |
- |
-Identity::~Identity() {} |
- |
-bool Identity::operator<(const Identity& other) const { |
- // We specifically don't include filter in the equivalence check because we |
- // don't quite know how this should work yet. |
- // TODO(beng): figure out how it should work. |
- if (name_ != other.name_) |
- return name_ < other.name_; |
- if (qualifier_ != other.qualifier_) |
- return qualifier_ < other.qualifier_; |
- return user_id_ < other.user_id_; |
-} |
- |
-bool Identity::operator==(const Identity& other) const { |
- // We specifically don't include filter in the equivalence check because we |
- // don't quite know how this should work yet. |
- // TODO(beng): figure out how it should work. |
- return other.name_ == name_ && other.qualifier_ == qualifier_ && |
- other.user_id_ == user_id_; |
-} |
- |
-Identity CreateShellIdentity() { |
- Identity id = Identity("mojo:shell", "", mojom::kRootUserID); |
- id.set_filter(GetPermissiveCapabilityFilter()); |
- return id; |
-} |
- |
-CapabilityFilter GetPermissiveCapabilityFilter() { |
- CapabilityFilter filter; |
- AllowedInterfaces interfaces; |
- interfaces.insert("*"); |
- filter["*"] = interfaces; |
- 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.name()); |
- 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 |