| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 std::string username = sync_statement.ColumnString(0); | 447 std::string username = sync_statement.ColumnString(0); |
| 448 if (gaia::AreEmailsSame(sync_username, username)) { | 448 if (gaia::AreEmailsSame(sync_username, username)) { |
| 449 syncing_account_saved = true; | 449 syncing_account_saved = true; |
| 450 break; | 450 break; |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 UMA_HISTOGRAM_ENUMERATION("PasswordManager.SyncingAccountState", | 454 UMA_HISTOGRAM_ENUMERATION("PasswordManager.SyncingAccountState", |
| 455 2 * sync_username.empty() + syncing_account_saved, | 455 2 * sync_username.empty() + syncing_account_saved, |
| 456 4); | 456 4); |
| 457 |
| 458 sql::Statement empty_usernames_statement(db_.GetCachedStatement( |
| 459 SQL_FROM_HERE, "SELECT COUNT(*) FROM logins " |
| 460 "WHERE blacklisted_by_user=0 AND username_value=''")); |
| 461 if (empty_usernames_statement.Step()) { |
| 462 int empty_forms = empty_usernames_statement.ColumnInt(0); |
| 463 UMA_HISTOGRAM_COUNTS_100("PasswordManager.EmptyUsernames.CountInDatabase", |
| 464 empty_forms); |
| 465 } |
| 457 } | 466 } |
| 458 | 467 |
| 459 PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) { | 468 PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) { |
| 460 PasswordStoreChangeList list; | 469 PasswordStoreChangeList list; |
| 461 if (!DoesMatchConstraints(form)) | 470 if (!DoesMatchConstraints(form)) |
| 462 return list; | 471 return list; |
| 463 std::string encrypted_password; | 472 std::string encrypted_password; |
| 464 if (EncryptedString(form.password_value, &encrypted_password) != | 473 if (EncryptedString(form.password_value, &encrypted_password) != |
| 465 ENCRYPTION_RESULT_SUCCESS) | 474 ENCRYPTION_RESULT_SUCCESS) |
| 466 return list; | 475 return list; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 | 889 |
| 881 bool LoginDatabase::DeleteAndRecreateDatabaseFile() { | 890 bool LoginDatabase::DeleteAndRecreateDatabaseFile() { |
| 882 DCHECK(db_.is_open()); | 891 DCHECK(db_.is_open()); |
| 883 meta_table_.Reset(); | 892 meta_table_.Reset(); |
| 884 db_.Close(); | 893 db_.Close(); |
| 885 sql::Connection::Delete(db_path_); | 894 sql::Connection::Delete(db_path_); |
| 886 return Init(); | 895 return Init(); |
| 887 } | 896 } |
| 888 | 897 |
| 889 } // namespace password_manager | 898 } // namespace password_manager |
| OLD | NEW |