Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: components/password_manager/core/browser/password_form_manager.cc

Issue 241033002: Fix for scoring password autofill candidates: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Indexing fix Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_form_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_form_manager.cc
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc
index 70fc1e5c98335fdc5f76aa04738f650f59415d71..1dfca54413e5ef3de8b0955adb2146b618e121b7 100644
--- a/components/password_manager/core/browser/password_form_manager.cc
+++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -633,18 +633,21 @@ void PasswordFormManager::CheckForAccountCreationForm(
int PasswordFormManager::ScoreResult(const PasswordForm& candidate) const {
DCHECK_EQ(state_, MATCHING_PHASE);
// For scoring of candidate login data:
- // The most important element that should match is the origin, followed by
- // the action, the password name, the submit button name, and finally the
- // username input field name.
+ // The most important element that should match is the signon_realm followed
+ // by the origin, the action, the password name, the submit button name, and
+ // finally the username input field name.
+ // If public suffix origin match was not used, it gives an addition of
+ // 128 (1 << 7).
// Exact origin match gives an addition of 64 (1 << 6) + # of matching url
// dirs.
// Partial match gives an addition of 32 (1 << 5) + # matching url dirs
// That way, a partial match cannot trump an exact match even if
// the partial one matches all other attributes (action, elements) (and
// regardless of the matching depth in the URL path).
- // If public suffix origin match was not used, it gives an addition of
- // 16 (1 << 4).
int score = 0;
+ if (!candidate.IsPublicSuffixMatch()) {
+ score += 1 << 7;
+ }
if (candidate.origin == observed_form_.origin) {
// This check is here for the most common case which
// is we have a single match in the db for the given host,
@@ -668,8 +671,6 @@ int PasswordFormManager::ScoreResult(const PasswordForm& candidate) const {
score += (depth > 0) ? 1 << 5 : 0;
}
if (observed_form_.scheme == PasswordForm::SCHEME_HTML) {
- if (!candidate.IsPublicSuffixMatch())
- score += 1 << 4;
if (candidate.action == observed_form_.action)
score += 1 << 3;
if (candidate.password_element == observed_form_.password_element)
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_form_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698