| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file contains utilities related to working with "facets". | 5 // This file contains utilities related to working with "facets". |
| 6 // | 6 // |
| 7 // A "facet" is defined as the manifestation of a logical application on a given | 7 // A "facet" is defined as the manifestation of a logical application on a given |
| 8 // platform. For example, "My Bank" may have released an Android application | 8 // platform. For example, "My Bank" may have released an Android application |
| 9 // and a Web application accessible from a browser. These are all facets of the | 9 // and a Web application accessible from a browser. These are all facets of the |
| 10 // "My Bank" logical application. | 10 // "My Bank" logical application. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 // Returns whether or not this instance represents a valid facet identifier | 100 // Returns whether or not this instance represents a valid facet identifier |
| 101 // referring to a Web application. | 101 // referring to a Web application. |
| 102 bool IsValidWebFacetURI() const; | 102 bool IsValidWebFacetURI() const; |
| 103 | 103 |
| 104 // Returns whether or not this instance represents a valid facet identifier | 104 // Returns whether or not this instance represents a valid facet identifier |
| 105 // referring to an Android application. | 105 // referring to an Android application. |
| 106 bool IsValidAndroidFacetURI() const; | 106 bool IsValidAndroidFacetURI() const; |
| 107 | 107 |
| 108 // Returns whether or not this instance represents a valid facet identifier | 108 // Returns whether or not this instance represents a valid facet identifier |
| 109 // referring to either a Web or an Android application. | 109 // referring to either a Web or an Android application. The empty identfier is |
| 110 // not considered valid. |
| 110 bool is_valid() const { return is_valid_; } | 111 bool is_valid() const { return is_valid_; } |
| 111 | 112 |
| 113 // Returns whether or not this instance represents the empty facet identifier. |
| 114 bool is_empty() const { return canonical_spec_.empty(); } |
| 115 |
| 112 // Returns the canonical scheme of the encapsulated facet URI, provided it is | 116 // Returns the canonical scheme of the encapsulated facet URI, provided it is |
| 113 // valid, or the empty string otherwise. | 117 // valid, or the empty string otherwise. |
| 114 std::string scheme() const; | 118 std::string scheme() const; |
| 115 | 119 |
| 116 // Returns the canonical package name that the encapsulated facet URI | 120 // Returns the canonical package name that the encapsulated facet URI |
| 117 // references, provided it is a valid Android facet URI, or the empty string | 121 // references, provided it is a valid Android facet URI, or the empty string |
| 118 // otherwise. | 122 // otherwise. |
| 119 std::string android_package_name() const; | 123 std::string android_package_name() const; |
| 120 | 124 |
| 121 // Returns the text of the encapsulated canonical URI, which must be valid. | 125 // Returns the text of the encapsulated canonical URI, which must be valid. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 template <> | 188 template <> |
| 185 struct hash<password_manager::FacetURI> { | 189 struct hash<password_manager::FacetURI> { |
| 186 size_t operator()(const password_manager::FacetURI& facet_uri) const { | 190 size_t operator()(const password_manager::FacetURI& facet_uri) const { |
| 187 return hash<std::string>()(facet_uri.potentially_invalid_spec()); | 191 return hash<std::string>()(facet_uri.potentially_invalid_spec()); |
| 188 } | 192 } |
| 189 }; | 193 }; |
| 190 | 194 |
| 191 } // namespace BASE_HASH_NAMESPACE | 195 } // namespace BASE_HASH_NAMESPACE |
| 192 | 196 |
| 193 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ | 197 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ |
| OLD | NEW |