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

Unified Diff: mojo/shell/identity.h

Issue 1769163002: Add a instance groups to Connect(), and introduce an Identity struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/connect_util.h ('k') | mojo/shell/identity.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/identity.h
diff --git a/mojo/shell/identity.h b/mojo/shell/identity.h
deleted file mode 100644
index 7d33295df65e0e647586356721582e144133f7a0..0000000000000000000000000000000000000000
--- a/mojo/shell/identity.h
+++ /dev/null
@@ -1,83 +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.
-
-#ifndef MOJO_SHELL_IDENTITY_H_
-#define MOJO_SHELL_IDENTITY_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <set>
-#include <string>
-
-namespace mojo {
-namespace shell {
-
-// A set of names of interfaces that may be exposed to an application.
-using AllowedInterfaces = std::set<std::string>;
-// A map of allowed applications to allowed interface sets. See shell.mojom for
-// more details.
-using CapabilityFilter = std::map<std::string, AllowedInterfaces>;
-
-// Represents the identity of an application.
-// |name| is the structured name of the application.
-// |qualifier| is a string that allows to tie a specific instance of an
-// application to another. A typical use case of qualifier is to control process
-// grouping for a given application name. For example, the core services are
-// grouped into "Core"/"Files"/"Network"/etc. using qualifier; content handler's
-// qualifier is derived from the origin of the content.
-class Identity {
- public:
- Identity();
- // Assumes user = mojom::kRootUserID.
- // Used in tests or for shell-initiated connections.
- explicit Identity(const std::string& in_name);
- Identity(const std::string& in_name,
- const std::string& in_qualifier,
- const std::string& user_id);
- Identity(const Identity& other);
- ~Identity();
-
- bool operator<(const Identity& other) const;
- bool is_null() const { return name_.empty(); }
- bool operator==(const Identity& other) const;
-
- const std::string& name() const { return name_; }
- const std::string& user_id() const { return user_id_; }
- void set_user_id(const std::string& user_id) { user_id_ = user_id; }
- const std::string& qualifier() const { return qualifier_; }
- void set_filter(const CapabilityFilter& filter) { filter_ = filter; }
- const CapabilityFilter& filter() const { return filter_; }
-
- private:
- std::string name_;
- std::string qualifier_;
-
- std::string user_id_;
-
- // TODO(beng): CapabilityFilter is not currently included in equivalence
- // checks for Identity since we're not currently clear on the
- // policy for instance disambiguation. Need to figure this out.
- // This field is supplied because it is logically part of the
- // instance identity of an application.
- CapabilityFilter filter_;
-};
-
-// Creates an identity for the Shell, used when the Shell connects to
-// applications.
-Identity CreateShellIdentity();
-
-// Returns a capability filter that allows an application to connect to any
-// other application and any service exposed by other applications.
-CapabilityFilter GetPermissiveCapabilityFilter();
-
-// Returns the set of interfaces that an application instance with |filter| is
-// allowed to see from an instance with |identity|.
-AllowedInterfaces GetAllowedInterfaces(const CapabilityFilter& filter,
- const Identity& identity);
-
-} // namespace shell
-} // namespace mojo
-
-#endif // MOJO_SHELL_IDENTITY_H_
« no previous file with comments | « mojo/shell/connect_util.h ('k') | mojo/shell/identity.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698