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

Unified Diff: mojo/shell/identity.cc

Issue 1719193003: Add a user id parameter to connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 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/identity.h ('k') | mojo/shell/public/cpp/connection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/identity.cc
diff --git a/mojo/shell/identity.cc b/mojo/shell/identity.cc
index 2c05b3f7722460a95b261eb17791a96177d1fd9b..f592da985dd3d3f88971e447502b1f5842777280 100644
--- a/mojo/shell/identity.cc
+++ b/mojo/shell/identity.cc
@@ -4,6 +4,8 @@
#include "mojo/shell/identity.h"
+#include "mojo/shell/public/interfaces/shell.mojom.h"
+
namespace mojo {
namespace shell {
namespace {
@@ -28,18 +30,17 @@ CapabilityFilter CanonicalizeFilter(const CapabilityFilter& filter) {
Identity::Identity() {}
Identity::Identity(const GURL& url)
- : url_(url),
- qualifier_(url_.spec()) {}
+ : Identity(url, url.spec(), mojom::Shell::kUserRoot) {}
-Identity::Identity(const GURL& url, const std::string& qualifier)
- : url_(url),
- qualifier_(qualifier.empty() ? url_.spec() : qualifier) {}
+Identity::Identity(const GURL& url, const std::string& qualifier,
+ uint32_t user_id)
+ : Identity(url, qualifier, user_id, CapabilityFilter()) {}
-Identity::Identity(const GURL& url,
- const std::string& qualifier,
- CapabilityFilter filter)
+Identity::Identity(const GURL& url, const std::string& qualifier,
+ uint32_t user_id, CapabilityFilter filter)
: url_(url),
qualifier_(qualifier.empty() ? url_.spec() : qualifier),
+ user_id_(user_id),
filter_(CanonicalizeFilter(filter)) {}
Identity::~Identity() {}
@@ -50,17 +51,19 @@ bool Identity::operator<(const Identity& other) const {
// TODO(beng): figure out how it should work.
if (url_ != other.url_)
return url_ < other.url_;
- return qualifier_ < other.qualifier_;
+ if (qualifier_ != other.qualifier_)
+ return qualifier_ < other.qualifier_;
+ return user_id_ < other.user_id_;
}
bool Identity::operator==(const Identity& other) const {
return other.url_ == url_ && other.qualifier_ == qualifier_ &&
- other.filter_ == filter_;
+ other.filter_ == filter_ && other.user_id_ == user_id_;
}
Identity CreateShellIdentity() {
return Identity(GURL("mojo://shell/"), std::string(),
- GetPermissiveCapabilityFilter());
+ mojom::Shell::kUserRoot, GetPermissiveCapabilityFilter());
}
} // namespace shell
« no previous file with comments | « mojo/shell/identity.h ('k') | mojo/shell/public/cpp/connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698