| 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 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 return CanonicalizeWebFacetURI(input_uri, input_parsed, canonical_uri); | 180 return CanonicalizeWebFacetURI(input_uri, input_parsed, canonical_uri); |
| 181 } else if (url::LowerCaseEqualsASCII(scheme.begin(), scheme.end(), | 181 } else if (url::LowerCaseEqualsASCII(scheme.begin(), scheme.end(), |
| 182 kAndroidAppScheme)) { | 182 kAndroidAppScheme)) { |
| 183 return CanonicalizeAndroidFacetURI(input_uri, input_parsed, canonical_uri); | 183 return CanonicalizeAndroidFacetURI(input_uri, input_parsed, canonical_uri); |
| 184 } | 184 } |
| 185 return false; | 185 return false; |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace | 188 } // namespace |
| 189 | 189 |
| 190 |
| 191 // FacetURI ------------------------------------------------------------------- |
| 192 |
| 190 FacetURI::FacetURI() : is_valid_(false) { | 193 FacetURI::FacetURI() : is_valid_(false) { |
| 191 } | 194 } |
| 192 | 195 |
| 193 // static | 196 // static |
| 194 FacetURI FacetURI::FromPotentiallyInvalidSpec(const std::string& spec) { | 197 FacetURI FacetURI::FromPotentiallyInvalidSpec(const std::string& spec) { |
| 195 std::string canonical_spec; | 198 std::string canonical_spec; |
| 196 bool is_valid = ParseAndCanonicalizeFacetURI(spec, &canonical_spec); | 199 bool is_valid = ParseAndCanonicalizeFacetURI(spec, &canonical_spec); |
| 197 return FacetURI(canonical_spec, is_valid); | 200 return FacetURI(canonical_spec, is_valid); |
| 198 } | 201 } |
| 199 | 202 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 250 } |
| 248 | 251 |
| 249 FacetURI::FacetURI(const std::string& canonical_spec, bool is_valid) | 252 FacetURI::FacetURI(const std::string& canonical_spec, bool is_valid) |
| 250 : is_valid_(is_valid), canonical_spec_(canonical_spec) { | 253 : is_valid_(is_valid), canonical_spec_(canonical_spec) { |
| 251 // TODO(engedy): Refactor code in order to avoid to avoid parsing the URL | 254 // TODO(engedy): Refactor code in order to avoid to avoid parsing the URL |
| 252 // twice. | 255 // twice. |
| 253 url::ParseStandardURL(canonical_spec_.c_str(), canonical_spec_.size(), | 256 url::ParseStandardURL(canonical_spec_.c_str(), canonical_spec_.size(), |
| 254 &parsed_); | 257 &parsed_); |
| 255 } | 258 } |
| 256 | 259 |
| 260 |
| 261 // AffiliatedFacetsWithUpdateTime --------------------------------------------- |
| 262 |
| 263 AffiliatedFacetsWithUpdateTime::AffiliatedFacetsWithUpdateTime() { |
| 264 } |
| 265 |
| 266 AffiliatedFacetsWithUpdateTime::~AffiliatedFacetsWithUpdateTime() { |
| 267 } |
| 268 |
| 269 |
| 270 // Helpers -------------------------------------------------------------------- |
| 271 |
| 257 bool AreEquivalenceClassesEqual(const AffiliatedFacets& a, | 272 bool AreEquivalenceClassesEqual(const AffiliatedFacets& a, |
| 258 const AffiliatedFacets& b) { | 273 const AffiliatedFacets& b) { |
| 259 if (a.size() != b.size()) | 274 if (a.size() != b.size()) |
| 260 return false; | 275 return false; |
| 261 | 276 |
| 262 std::vector<FacetURI> a_sorted(a.begin(), a.end()); | 277 std::vector<FacetURI> a_sorted(a.begin(), a.end()); |
| 263 std::vector<FacetURI> b_sorted(b.begin(), b.end()); | 278 std::vector<FacetURI> b_sorted(b.begin(), b.end()); |
| 264 std::sort(a_sorted.begin(), a_sorted.end()); | 279 std::sort(a_sorted.begin(), a_sorted.end()); |
| 265 std::sort(b_sorted.begin(), b_sorted.end()); | 280 std::sort(b_sorted.begin(), b_sorted.end()); |
| 266 return std::equal(a_sorted.begin(), a_sorted.end(), b_sorted.begin()); | 281 return std::equal(a_sorted.begin(), a_sorted.end(), b_sorted.begin()); |
| 267 } | 282 } |
| 268 | 283 |
| 269 } // namespace password_manager | 284 } // namespace password_manager |
| OLD | NEW |