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

Side by Side Diff: mojo/shell/identity.h

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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_SHELL_IDENTITY_H_ 5 #ifndef MOJO_SHELL_IDENTITY_H_
6 #define MOJO_SHELL_IDENTITY_H_ 6 #define MOJO_SHELL_IDENTITY_H_
7 7
8 #include "mojo/shell/capability_filter.h" 8 #include "mojo/shell/capability_filter.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 namespace shell { 12 namespace shell {
13 13
14 // Represents the identity of an application. 14 // Represents the identity of an application.
15 // |url| is the URL of the application. 15 // |url| is the URL of the application.
16 // |qualifier| is a string that allows to tie a specific instance of an 16 // |qualifier| is a string that allows to tie a specific instance of an
17 // application to another. A typical use case of qualifier is to control process 17 // application to another. A typical use case of qualifier is to control process
18 // grouping for a given application URL. For example, the core services are 18 // grouping for a given application URL. For example, the core services are
19 // grouped into "Core"/"Files"/"Network"/etc. using qualifier; content handler's 19 // grouped into "Core"/"Files"/"Network"/etc. using qualifier; content handler's
20 // qualifier is derived from the origin of the content. 20 // qualifier is derived from the origin of the content.
21 class Identity { 21 class Identity {
22 public: 22 public:
23 Identity(); 23 Identity();
24 // Assumes user = mojom::Shell::kUserRoot.
25 // Used in tests or for shell-initiated connections.
24 explicit Identity(const GURL& in_url); 26 explicit Identity(const GURL& in_url);
25 Identity(const GURL& in_url, const std::string& in_qualifier);
26 Identity(const GURL& in_url, 27 Identity(const GURL& in_url,
27 const std::string& in_qualifier, 28 const std::string& in_qualifier,
29 uint32_t user_id);
30 Identity(const GURL& in_url,
31 const std::string& in_qualifier,
32 uint32_t user,
28 CapabilityFilter filter); 33 CapabilityFilter filter);
29 ~Identity(); 34 ~Identity();
30 35
31 bool operator<(const Identity& other) const; 36 bool operator<(const Identity& other) const;
32 bool is_null() const { return url_.is_empty(); } 37 bool is_null() const { return url_.is_empty(); }
33 bool operator==(const Identity& other) const; 38 bool operator==(const Identity& other) const;
34 39
35 const GURL& url() const { return url_; } 40 const GURL& url() const { return url_; }
41 const uint32_t user_id() const { return user_id_; }
42 void set_user_id(uint32_t user_id) { user_id_ = user_id; }
36 const std::string& qualifier() const { return qualifier_; } 43 const std::string& qualifier() const { return qualifier_; }
37 const CapabilityFilter& filter() const { return filter_; } 44 const CapabilityFilter& filter() const { return filter_; }
38 45
39 private: 46 private:
40 GURL url_; 47 GURL url_;
41 std::string qualifier_; 48 std::string qualifier_;
42 49
50 uint32_t user_id_;
51
43 // TODO(beng): CapabilityFilter is not currently included in equivalence 52 // TODO(beng): CapabilityFilter is not currently included in equivalence
44 // checks for Identity since we're not currently clear on the 53 // checks for Identity since we're not currently clear on the
45 // policy for instance disambiguation. Need to figure this out. 54 // policy for instance disambiguation. Need to figure this out.
46 // This field is supplied because it is logically part of the 55 // This field is supplied because it is logically part of the
47 // instance identity of an application. 56 // instance identity of an application.
48 CapabilityFilter filter_; 57 CapabilityFilter filter_;
49 }; 58 };
50 59
51 // Creates an identity for the Shell, used when the Shell connects to 60 // Creates an identity for the Shell, used when the Shell connects to
52 // applications. 61 // applications.
53 Identity CreateShellIdentity(); 62 Identity CreateShellIdentity();
54 63
55 } // namespace shell 64 } // namespace shell
56 } // namespace mojo 65 } // namespace mojo
57 66
58 #endif // MOJO_SHELL_IDENTITY_H_ 67 #endif // MOJO_SHELL_IDENTITY_H_
OLDNEW
« no previous file with comments | « mojo/shell/connect_util.h ('k') | mojo/shell/identity.cc » ('j') | mojo/shell/identity.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698