Chromium Code Reviews| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 4); | 497 4); |
| 498 | 498 |
| 499 sql::Statement empty_usernames_statement(db_.GetCachedStatement( | 499 sql::Statement empty_usernames_statement(db_.GetCachedStatement( |
| 500 SQL_FROM_HERE, "SELECT COUNT(*) FROM logins " | 500 SQL_FROM_HERE, "SELECT COUNT(*) FROM logins " |
| 501 "WHERE blacklisted_by_user=0 AND username_value=''")); | 501 "WHERE blacklisted_by_user=0 AND username_value=''")); |
| 502 if (empty_usernames_statement.Step()) { | 502 if (empty_usernames_statement.Step()) { |
| 503 int empty_forms = empty_usernames_statement.ColumnInt(0); | 503 int empty_forms = empty_usernames_statement.ColumnInt(0); |
| 504 UMA_HISTOGRAM_COUNTS_100("PasswordManager.EmptyUsernames.CountInDatabase", | 504 UMA_HISTOGRAM_COUNTS_100("PasswordManager.EmptyUsernames.CountInDatabase", |
| 505 empty_forms); | 505 empty_forms); |
| 506 } | 506 } |
| 507 | |
| 508 sql::Statement standalone_empty_usernames_statement(db_.GetCachedStatement( | |
| 509 SQL_FROM_HERE, "SELECT COUNT(*) FROM logins a " | |
| 510 "WHERE a.blacklisted_by_user=0 AND a.username_value='' " | |
| 511 "AND NOT EXISTS (SELECT * FROM logins b " | |
|
vasilii
2015/04/15 15:51:55
I'd reverse the condition as "There is a correspon
msramek
2015/04/16 14:34:26
Well, that was my original intention. But then I r
| |
| 512 "WHERE b.blacklisted_by_user=0 AND b.username_value!='' " | |
| 513 "AND a.signon_realm = b.signon_realm)")); | |
| 514 if (standalone_empty_usernames_statement.Step()) { | |
| 515 int num_entries = standalone_empty_usernames_statement.ColumnInt(0); | |
| 516 UMA_HISTOGRAM_COUNTS_100("PasswordManager.EmptyUsernames." | |
| 517 "NotPairedWithNonempty", | |
|
Ilya Sherman
2015/04/15 22:56:05
nit: Rather than splitting this string across mult
msramek
2015/04/16 14:34:26
Done.
| |
| 518 num_entries); | |
| 519 } | |
| 507 } | 520 } |
| 508 | 521 |
| 509 PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) { | 522 PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) { |
| 510 PasswordStoreChangeList list; | 523 PasswordStoreChangeList list; |
| 511 if (!DoesMatchConstraints(form)) | 524 if (!DoesMatchConstraints(form)) |
| 512 return list; | 525 return list; |
| 513 std::string encrypted_password; | 526 std::string encrypted_password; |
| 514 if (EncryptedString(form.password_value, &encrypted_password) != | 527 if (EncryptedString(form.password_value, &encrypted_password) != |
| 515 ENCRYPTION_RESULT_SUCCESS) | 528 ENCRYPTION_RESULT_SUCCESS) |
| 516 return list; | 529 return list; |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 932 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", | 945 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", |
| 933 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); | 946 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); |
| 934 } | 947 } |
| 935 | 948 |
| 936 if (!statement->Succeeded()) | 949 if (!statement->Succeeded()) |
| 937 return false; | 950 return false; |
| 938 return true; | 951 return true; |
| 939 } | 952 } |
| 940 | 953 |
| 941 } // namespace password_manager | 954 } // namespace password_manager |
| OLD | NEW |