| 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 #include "components/password_manager/core/browser/affiliation_utils.h" | 5 #include "components/password_manager/core/browser/affiliation_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 std::sort(a_sorted.begin(), a_sorted.end()); | 288 std::sort(a_sorted.begin(), a_sorted.end()); |
| 289 std::sort(b_sorted.begin(), b_sorted.end()); | 289 std::sort(b_sorted.begin(), b_sorted.end()); |
| 290 return std::equal(a_sorted.begin(), a_sorted.end(), b_sorted.begin()); | 290 return std::equal(a_sorted.begin(), a_sorted.end(), b_sorted.begin()); |
| 291 } | 291 } |
| 292 | 292 |
| 293 bool IsValidAndroidFacetURI(const std::string& url) { | 293 bool IsValidAndroidFacetURI(const std::string& url) { |
| 294 FacetURI facet = FacetURI::FromPotentiallyInvalidSpec(url); | 294 FacetURI facet = FacetURI::FromPotentiallyInvalidSpec(url); |
| 295 return facet.IsValidAndroidFacetURI(); | 295 return facet.IsValidAndroidFacetURI(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 std::string GetHumanReadableOrigin(const autofill::PasswordForm& password_form, | 298 std::string GetHumanReadableOrigin( |
| 299 const std::string& languages) { | 299 const autofill::PasswordForm& password_form) { |
| 300 FacetURI facet_uri = | 300 FacetURI facet_uri = |
| 301 FacetURI::FromPotentiallyInvalidSpec(password_form.signon_realm); | 301 FacetURI::FromPotentiallyInvalidSpec(password_form.signon_realm); |
| 302 if (facet_uri.IsValidAndroidFacetURI()) | 302 if (facet_uri.IsValidAndroidFacetURI()) |
| 303 return GetHumanReadableOriginForAndroidUri(facet_uri); | 303 return GetHumanReadableOriginForAndroidUri(facet_uri); |
| 304 | 304 |
| 305 return base::UTF16ToUTF8(url_formatter::FormatUrlForSecurityDisplay( | 305 return base::UTF16ToUTF8( |
| 306 password_form.origin, languages)); | 306 url_formatter::FormatUrlForSecurityDisplay(password_form.origin)); |
| 307 } | 307 } |
| 308 | 308 |
| 309 std::string GetHumanReadableOriginForAndroidUri(const FacetURI facet_uri) { | 309 std::string GetHumanReadableOriginForAndroidUri(const FacetURI facet_uri) { |
| 310 DCHECK(facet_uri.IsValidAndroidFacetURI()); | 310 DCHECK(facet_uri.IsValidAndroidFacetURI()); |
| 311 return facet_uri.scheme() + "://" + facet_uri.android_package_name(); | 311 return facet_uri.scheme() + "://" + facet_uri.android_package_name(); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace password_manager | 314 } // namespace password_manager |
| OLD | NEW |