| 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/login_database.h" | 5 #include "components/password_manager/core/browser/login_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 if (psl_match && psl_match->signon_realm != new_form->signon_realm) { | 1220 if (psl_match && psl_match->signon_realm != new_form->signon_realm) { |
| 1221 if (new_form->scheme != PasswordForm::SCHEME_HTML) | 1221 if (new_form->scheme != PasswordForm::SCHEME_HTML) |
| 1222 continue; // Ignore non-HTML matches. | 1222 continue; // Ignore non-HTML matches. |
| 1223 | 1223 |
| 1224 if (!IsPublicSuffixDomainMatch(new_form->signon_realm, | 1224 if (!IsPublicSuffixDomainMatch(new_form->signon_realm, |
| 1225 psl_match->signon_realm)) { | 1225 psl_match->signon_realm)) { |
| 1226 continue; | 1226 continue; |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 psl_domain_match_metric = PSL_DOMAIN_MATCH_FOUND; | 1229 psl_domain_match_metric = PSL_DOMAIN_MATCH_FOUND; |
| 1230 // This is not a perfect match, so we need to create a new valid result. | 1230 new_form->is_public_suffix_match = true; |
| 1231 // We do this by copying over origin, signon realm and action from the | |
| 1232 // observed form and setting the original signon realm to what we found | |
| 1233 // in the database. We use the fact that |original_signon_realm| is | |
| 1234 // non-empty to communicate that this match was found using public | |
| 1235 // suffix matching. | |
| 1236 new_form->original_signon_realm = new_form->signon_realm; | |
| 1237 new_form->origin = psl_match->origin; | |
| 1238 new_form->signon_realm = psl_match->signon_realm; | |
| 1239 new_form->action = psl_match->action; | |
| 1240 } | 1231 } |
| 1241 forms->push_back(new_form.Pass()); | 1232 forms->push_back(new_form.Pass()); |
| 1242 } | 1233 } |
| 1243 | 1234 |
| 1244 if (psl_match) { | 1235 if (psl_match) { |
| 1245 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", | 1236 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", |
| 1246 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); | 1237 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); |
| 1247 } | 1238 } |
| 1248 | 1239 |
| 1249 if (!statement->Succeeded()) | 1240 if (!statement->Succeeded()) |
| 1250 return false; | 1241 return false; |
| 1251 return true; | 1242 return true; |
| 1252 } | 1243 } |
| 1253 | 1244 |
| 1254 } // namespace password_manager | 1245 } // namespace password_manager |
| OLD | NEW |