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

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: 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 | no next file » | 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..943bd240913b7272cda66c124f3c14663c7332c9 100644
--- a/components/password_manager/core/browser/password_form_manager.cc
+++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -633,9 +633,10 @@ 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.
+ // Exact signon realm match 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
@@ -645,7 +646,12 @@ int PasswordFormManager::ScoreResult(const PasswordForm& candidate) const {
// If public suffix origin match was not used, it gives an addition of
// 16 (1 << 4).
int score = 0;
- if (candidate.origin == observed_form_.origin) {
+ if (candidate.original_signon_realm.empty() ||
+ candidate.original_signon_realm == observed_form_.signon_realm) {
Garrett Casto 2014/04/17 21:12:39 Actually, I think this should just be !candidate.I
+ // If credentials come from different signon realm, then
+ // original_signon_realm will be non-empty string
+ score += (1 << 7);
Garrett Casto 2014/04/17 21:12:39 This isn't completely consistent here, but I think
+ } else 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,
// so we don't generally need to walk the entire URL path (the else
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698