Chromium Code Reviews| 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" | |
| 8 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 9 | 10 |
| 10 namespace mojo { | 11 namespace mojo { |
| 11 namespace shell { | 12 namespace shell { |
| 12 | 13 |
| 13 // Represents the identity of an application. | 14 // Represents the identity of an application. |
| 14 // |url| is the URL of the application. | 15 // |url| is the URL of the application. |
| 15 // |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 |
| 16 // 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 |
| 17 // 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 |
| 18 // grouped into "Core"/"Files"/"Network"/etc. using qualifier; content handler's | 19 // grouped into "Core"/"Files"/"Network"/etc. using qualifier; content handler's |
| 19 // qualifier is derived from the origin of the content. | 20 // qualifier is derived from the origin of the content. |
| 20 struct Identity { | 21 // If a CapabilityFilter is not specified via the constructor, an instance of |
| 22 // Identity is constructed with a permissive filter (allowing connection to | |
|
yzshen1
2015/09/18 21:44:04
Please update this comment.
yzshen1
2015/09/18 21:51:08
(You probably didn't notice this comment. :))
| |
| 23 // all apps and services). | |
| 24 class Identity { | |
| 25 public: | |
| 21 Identity(); | 26 Identity(); |
| 27 explicit Identity(const GURL& in_url); | |
| 22 Identity(const GURL& in_url, const std::string& in_qualifier); | 28 Identity(const GURL& in_url, const std::string& in_qualifier); |
| 23 explicit Identity(const GURL& in_url); | 29 Identity(const GURL& in_url, |
| 30 const std::string& in_qualifier, | |
| 31 CapabilityFilter filter); | |
| 32 ~Identity(); | |
| 24 | 33 |
| 25 bool operator<(const Identity& other) const; | 34 bool operator<(const Identity& other) const; |
| 26 bool is_null() const { return url.is_empty(); } | 35 bool is_null() const { return url_.is_empty(); } |
| 27 | 36 |
| 28 GURL url; | 37 const GURL& url() const { return url_; } |
| 29 std::string qualifier; | 38 const std::string& qualifier() const { return qualifier_; } |
| 39 const CapabilityFilter& filter() const { return filter_; } | |
| 40 | |
| 41 private: | |
| 42 GURL url_; | |
| 43 std::string qualifier_; | |
| 44 | |
| 45 // TODO(beng): CapabilityFilter is not currently included in equivalence | |
| 46 // checks for Identity since we're not currently clear on the | |
| 47 // policy for instance disambiguation. Need to figure this out. | |
| 48 // This field is supplied because it is logically part of the | |
| 49 // instance identity of an application. | |
| 50 CapabilityFilter filter_; | |
| 30 }; | 51 }; |
| 31 | 52 |
| 32 } // namespace shell | 53 } // namespace shell |
| 33 } // namespace mojo | 54 } // namespace mojo |
| 34 | 55 |
| 35 #endif // MOJO_SHELL_IDENTITY_H_ | 56 #endif // MOJO_SHELL_IDENTITY_H_ |
| OLD | NEW |