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

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

Issue 892443002: Add UMA histograms for tracking empty usernames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.NumEmptyUsernames", empty_forms);
464 }
457 } 465 }
458 466
459 PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) { 467 PasswordStoreChangeList LoginDatabase::AddLogin(const PasswordForm& form) {
460 PasswordStoreChangeList list; 468 PasswordStoreChangeList list;
461 if (!DoesMatchConstraints(form)) 469 if (!DoesMatchConstraints(form))
462 return list; 470 return list;
463 std::string encrypted_password; 471 std::string encrypted_password;
464 if (EncryptedString(form.password_value, &encrypted_password) != 472 if (EncryptedString(form.password_value, &encrypted_password) !=
465 ENCRYPTION_RESULT_SUCCESS) 473 ENCRYPTION_RESULT_SUCCESS)
466 return list; 474 return list;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 888
881 bool LoginDatabase::DeleteAndRecreateDatabaseFile() { 889 bool LoginDatabase::DeleteAndRecreateDatabaseFile() {
882 DCHECK(db_.is_open()); 890 DCHECK(db_.is_open());
883 meta_table_.Reset(); 891 meta_table_.Reset();
884 db_.Close(); 892 db_.Close();
885 sql::Connection::Delete(db_path_); 893 sql::Connection::Delete(db_path_);
886 return Init(); 894 return Init();
887 } 895 }
888 896
889 } // namespace password_manager 897 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698