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

Side by Side Diff: components/password_manager/core/browser/login_database.cc

Issue 1314903003: Updating of all entries in PasswordManager of the same credentials on password update (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bot fix Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 return PasswordStoreChangeList(); 929 return PasswordStoreChangeList();
930 930
931 PasswordStoreChangeList list; 931 PasswordStoreChangeList list;
932 if (db_.GetLastChangeCount()) 932 if (db_.GetLastChangeCount())
933 list.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form)); 933 list.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form));
934 934
935 return list; 935 return list;
936 } 936 }
937 937
938 bool LoginDatabase::RemoveLogin(const PasswordForm& form) { 938 bool LoginDatabase::RemoveLogin(const PasswordForm& form) {
939 if (form.IsPublicSuffixMatch()) { 939 if (form.is_public_suffix_match) {
940 // Do not try to remove |form|. It is a modified copy of a password stored 940 // TODO(dvadym): Discuss whether we should allow to remove PSL matched
941 // for a different origin, and it is not contained in the database. 941 // credentials.
942 return false; 942 return false;
943 } 943 }
944 // Remove a login by UNIQUE-constrained fields. 944 // Remove a login by UNIQUE-constrained fields.
945 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, 945 sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
946 "DELETE FROM logins WHERE " 946 "DELETE FROM logins WHERE "
947 "origin_url = ? AND " 947 "origin_url = ? AND "
948 "username_element = ? AND " 948 "username_element = ? AND "
949 "username_value = ? AND " 949 "username_value = ? AND "
950 "password_element = ? AND " 950 "password_element = ? AND "
951 "submit_element = ? AND " 951 "submit_element = ? AND "
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698