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