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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Returns whether or not equivalence classes |a| and |b| are equal, that is, | 173 // Returns whether or not equivalence classes |a| and |b| are equal, that is, |
174 // whether or not they consist of the same set of facets. | 174 // whether or not they consist of the same set of facets. |
175 // | 175 // |
176 // Note that this will do some sorting, so it can be expensive for large inputs. | 176 // Note that this will do some sorting, so it can be expensive for large inputs. |
177 bool AreEquivalenceClassesEqual(const AffiliatedFacets& a, | 177 bool AreEquivalenceClassesEqual(const AffiliatedFacets& a, |
178 const AffiliatedFacets& b); | 178 const AffiliatedFacets& b); |
179 | 179 |
180 // A shorter way to spell FacetURI::IsValidAndroidFacetURI(). | 180 // A shorter way to spell FacetURI::IsValidAndroidFacetURI(). |
181 bool IsValidAndroidFacetURI(const std::string& uri); | 181 bool IsValidAndroidFacetURI(const std::string& uri); |
182 | 182 |
183 // Returns whether or not affiliation based matching is enabled. The feature is | |
184 // enabled by default, but can be disabled either via command line flags or | |
185 // field trials. The command line flag, if present, always takes precedence. | |
186 bool IsAffiliationBasedMatchingEnabled(const base::CommandLine& command_line); | |
187 | |
188 // Returns whether or not propagating password changes to affiliated saved web | |
189 // credentials is enabled. It is enabled by default, but can be disabled | |
190 // separately via variation parameters while leaving the rest of the | |
191 // affiliation-based matching enabled. If the main feature is forced | |
192 // enabled/disabled via the command line, this sub-feature will be force | |
193 // enabled/disabled correspondingly. | |
194 bool IsPropagatingPasswordChangesToWebCredentialsEnabled( | |
195 const base::CommandLine& command_line); | |
196 | |
197 // Returns the origin URI in a format which can be presented to a user based of | 183 // Returns the origin URI in a format which can be presented to a user based of |
198 // |password_from| field values. For web URIs |languages| is using in order to | 184 // |password_from| field values. For web URIs |languages| is using in order to |
199 // determine whether a URI is 'comprehensible' to a user who understands | 185 // determine whether a URI is 'comprehensible' to a user who understands |
200 // languages listed. | 186 // languages listed. |
201 std::string GetHumanReadableOrigin(const autofill::PasswordForm& password_form, | 187 std::string GetHumanReadableOrigin(const autofill::PasswordForm& password_form, |
202 const std::string& languages); | 188 const std::string& languages); |
203 | 189 |
204 // Returns the Android origin URI for presenting to a user. | 190 // Returns the Android origin URI for presenting to a user. |
205 std::string GetHumanReadableOriginForAndroidUri(const FacetURI facet_uri); | 191 std::string GetHumanReadableOriginForAndroidUri(const FacetURI facet_uri); |
206 | 192 |
207 // For logging use only. | 193 // For logging use only. |
208 std::ostream& operator<<(std::ostream& os, const FacetURI& facet_uri); | 194 std::ostream& operator<<(std::ostream& os, const FacetURI& facet_uri); |
209 | 195 |
210 } // namespace password_manager | 196 } // namespace password_manager |
211 | 197 |
212 // Provide a hash function so that hash_sets and maps can contain FacetURIs. | 198 // Provide a hash function so that hash_sets and maps can contain FacetURIs. |
213 namespace BASE_HASH_NAMESPACE { | 199 namespace BASE_HASH_NAMESPACE { |
214 | 200 |
215 template <> | 201 template <> |
216 struct hash<password_manager::FacetURI> { | 202 struct hash<password_manager::FacetURI> { |
217 size_t operator()(const password_manager::FacetURI& facet_uri) const { | 203 size_t operator()(const password_manager::FacetURI& facet_uri) const { |
218 return hash<std::string>()(facet_uri.potentially_invalid_spec()); | 204 return hash<std::string>()(facet_uri.potentially_invalid_spec()); |
219 } | 205 } |
220 }; | 206 }; |
221 | 207 |
222 } // namespace BASE_HASH_NAMESPACE | 208 } // namespace BASE_HASH_NAMESPACE |
223 | 209 |
224 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ | 210 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_ |
OLD | NEW |