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

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

Issue 1734643003: Remove CapabilityFilter from Connect() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@13connector2
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 unified diff | Download patch
« no previous file with comments | « mojo/shell/connect_util.h ('k') | mojo/shell/identity.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::Connector::kUserRoot. 24 // Assumes user = mojom::Connector::kUserRoot.
25 // Used in tests or for shell-initiated connections. 25 // Used in tests or for shell-initiated connections.
26 explicit Identity(const GURL& in_url); 26 explicit Identity(const GURL& in_url);
27 Identity(const GURL& in_url, 27 Identity(const GURL& in_url,
28 const std::string& in_qualifier, 28 const std::string& in_qualifier,
29 uint32_t user_id); 29 uint32_t user_id);
30 Identity(const GURL& in_url,
31 const std::string& in_qualifier,
32 uint32_t user,
33 CapabilityFilter filter);
34 ~Identity(); 30 ~Identity();
35 31
36 bool operator<(const Identity& other) const; 32 bool operator<(const Identity& other) const;
37 bool is_null() const { return url_.is_empty(); } 33 bool is_null() const { return url_.is_empty(); }
38 bool operator==(const Identity& other) const; 34 bool operator==(const Identity& other) const;
39 35
40 const GURL& url() const { return url_; } 36 const GURL& url() const { return url_; }
41 uint32_t user_id() const { return user_id_; } 37 uint32_t user_id() const { return user_id_; }
42 void set_user_id(uint32_t user_id) { user_id_ = user_id; } 38 void set_user_id(uint32_t user_id) { user_id_ = user_id; }
43 const std::string& qualifier() const { return qualifier_; } 39 const std::string& qualifier() const { return qualifier_; }
40 void SetFilter(const CapabilityFilter& filter);
44 const CapabilityFilter& filter() const { return filter_; } 41 const CapabilityFilter& filter() const { return filter_; }
45 42
46 private: 43 private:
47 GURL url_; 44 GURL url_;
48 std::string qualifier_; 45 std::string qualifier_;
49 46
50 uint32_t user_id_; 47 uint32_t user_id_;
51 48
52 // TODO(beng): CapabilityFilter is not currently included in equivalence 49 // TODO(beng): CapabilityFilter is not currently included in equivalence
53 // checks for Identity since we're not currently clear on the 50 // checks for Identity since we're not currently clear on the
54 // policy for instance disambiguation. Need to figure this out. 51 // policy for instance disambiguation. Need to figure this out.
55 // This field is supplied because it is logically part of the 52 // This field is supplied because it is logically part of the
56 // instance identity of an application. 53 // instance identity of an application.
57 CapabilityFilter filter_; 54 CapabilityFilter filter_;
58 }; 55 };
59 56
60 // Creates an identity for the Shell, used when the Shell connects to 57 // Creates an identity for the Shell, used when the Shell connects to
61 // applications. 58 // applications.
62 Identity CreateShellIdentity(); 59 Identity CreateShellIdentity();
63 60
64 } // namespace shell 61 } // namespace shell
65 } // namespace mojo 62 } // namespace mojo
66 63
67 #endif // MOJO_SHELL_IDENTITY_H_ 64 #endif // MOJO_SHELL_IDENTITY_H_
OLDNEW
« 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