OLD | NEW |
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" | |
9 #include "url/gurl.h" | 8 #include "url/gurl.h" |
10 | 9 |
11 namespace mojo { | 10 namespace mojo { |
12 namespace shell { | 11 namespace shell { |
13 | 12 |
14 // Represents the identity of an application. | 13 // Represents the identity of an application. |
15 // |url| is the URL of the application. | 14 // |url| is the URL of the application. |
16 // |qualifier| is a string that allows to tie a specific instance of an | 15 // |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 | 16 // 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 | 17 // grouping for a given application URL. For example, the core services are |
19 // grouped into "Core"/"Files"/"Network"/etc. using qualifier; content handler's | 18 // grouped into "Core"/"Files"/"Network"/etc. using qualifier; content handler's |
20 // qualifier is derived from the origin of the content. | 19 // qualifier is derived from the origin of the content. |
21 class Identity { | 20 struct Identity { |
22 public: | |
23 Identity(); | 21 Identity(); |
| 22 Identity(const GURL& in_url, const std::string& in_qualifier); |
24 explicit Identity(const GURL& in_url); | 23 explicit Identity(const GURL& in_url); |
25 Identity(const GURL& in_url, const std::string& in_qualifier); | |
26 Identity(const GURL& in_url, | |
27 const std::string& in_qualifier, | |
28 CapabilityFilter filter); | |
29 ~Identity(); | |
30 | 24 |
31 bool operator<(const Identity& other) const; | 25 bool operator<(const Identity& other) const; |
32 bool is_null() const { return url_.is_empty(); } | 26 bool is_null() const { return url.is_empty(); } |
33 | 27 |
34 const GURL& url() const { return url_; } | 28 GURL url; |
35 const std::string& qualifier() const { return qualifier_; } | 29 std::string qualifier; |
36 const CapabilityFilter& filter() const { return filter_; } | |
37 | |
38 private: | |
39 GURL url_; | |
40 std::string qualifier_; | |
41 | |
42 // TODO(beng): CapabilityFilter is not currently included in equivalence | |
43 // checks for Identity since we're not currently clear on the | |
44 // policy for instance disambiguation. Need to figure this out. | |
45 // This field is supplied because it is logically part of the | |
46 // instance identity of an application. | |
47 CapabilityFilter filter_; | |
48 }; | 30 }; |
49 | 31 |
50 } // namespace shell | 32 } // namespace shell |
51 } // namespace mojo | 33 } // namespace mojo |
52 | 34 |
53 #endif // MOJO_SHELL_IDENTITY_H_ | 35 #endif // MOJO_SHELL_IDENTITY_H_ |
OLD | NEW |