| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 bool is_valid = ParseAndCanonicalizeFacetURI(spec, &canonical_spec); | 202 bool is_valid = ParseAndCanonicalizeFacetURI(spec, &canonical_spec); |
| 203 return FacetURI(canonical_spec, is_valid); | 203 return FacetURI(canonical_spec, is_valid); |
| 204 } | 204 } |
| 205 | 205 |
| 206 // static | 206 // static |
| 207 FacetURI FacetURI::FromCanonicalSpec(const std::string& canonical_spec) { | 207 FacetURI FacetURI::FromCanonicalSpec(const std::string& canonical_spec) { |
| 208 return FacetURI(canonical_spec, true); | 208 return FacetURI(canonical_spec, true); |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool FacetURI::operator==(const FacetURI& other) const { | 211 bool FacetURI::operator==(const FacetURI& other) const { |
| 212 DCHECK(is_valid_); | 212 DCHECK(is_empty() || is_valid()); |
| 213 DCHECK(other.is_valid_); | 213 DCHECK(other.is_empty() || other.is_valid()); |
| 214 return canonical_spec_ == other.canonical_spec_; | 214 return canonical_spec_ == other.canonical_spec_; |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool FacetURI::operator!=(const FacetURI& other) const { | 217 bool FacetURI::operator!=(const FacetURI& other) const { |
| 218 DCHECK(is_valid_); | 218 DCHECK(is_empty() || is_valid()); |
| 219 DCHECK(other.is_valid_); | 219 DCHECK(other.is_empty() || other.is_valid()); |
| 220 return canonical_spec_ != other.canonical_spec_; | 220 return canonical_spec_ != other.canonical_spec_; |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool FacetURI::operator<(const FacetURI& other) const { | 223 bool FacetURI::operator<(const FacetURI& other) const { |
| 224 DCHECK(is_valid_); | 224 DCHECK(is_empty() || is_valid()); |
| 225 DCHECK(other.is_valid_); | 225 DCHECK(other.is_empty() || other.is_valid()); |
| 226 return canonical_spec_ < other.canonical_spec_; | 226 return canonical_spec_ < other.canonical_spec_; |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool FacetURI::operator>(const FacetURI& other) const { | 229 bool FacetURI::operator>(const FacetURI& other) const { |
| 230 DCHECK(is_valid_); | 230 DCHECK(is_empty() || is_valid()); |
| 231 DCHECK(other.is_valid_); | 231 DCHECK(other.is_empty() || other.is_valid()); |
| 232 return canonical_spec_ > other.canonical_spec_; | 232 return canonical_spec_ > other.canonical_spec_; |
| 233 } | 233 } |
| 234 | 234 |
| 235 bool FacetURI::IsValidWebFacetURI() const { | 235 bool FacetURI::IsValidWebFacetURI() const { |
| 236 return scheme() == url::kHttpsScheme; | 236 return scheme() == url::kHttpsScheme; |
| 237 } | 237 } |
| 238 | 238 |
| 239 bool FacetURI::IsValidAndroidFacetURI() const { | 239 bool FacetURI::IsValidAndroidFacetURI() const { |
| 240 return scheme() == kAndroidAppScheme; | 240 return scheme() == kAndroidAppScheme; |
| 241 } | 241 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return true; | 300 return true; |
| 301 return StartsWithASCII(group_name, "Enabled", /*case_sensitive=*/false); | 301 return StartsWithASCII(group_name, "Enabled", /*case_sensitive=*/false); |
| 302 } | 302 } |
| 303 | 303 |
| 304 bool IsValidAndroidFacetURI(const std::string& url) { | 304 bool IsValidAndroidFacetURI(const std::string& url) { |
| 305 FacetURI facet = FacetURI::FromPotentiallyInvalidSpec(url); | 305 FacetURI facet = FacetURI::FromPotentiallyInvalidSpec(url); |
| 306 return facet.IsValidAndroidFacetURI(); | 306 return facet.IsValidAndroidFacetURI(); |
| 307 } | 307 } |
| 308 | 308 |
| 309 } // namespace password_manager | 309 } // namespace password_manager |
| OLD | NEW |