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

Unified Diff: chrome/browser/password_manager/login_database.cc

Issue 2834009: Implement Password Manager aggregate metrics reporting (Closed)
Patch Set: rebase to head Created 10 years, 6 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
Index: chrome/browser/password_manager/login_database.cc
diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc
index d66135ac4ad8e78cd08665d151b553fbcbc9fda6..0c8d300a1e93c176802f9ed1a1f0956ad0b06094 100644
--- a/chrome/browser/password_manager/login_database.cc
+++ b/chrome/browser/password_manager/login_database.cc
@@ -10,6 +10,7 @@
#include "app/sql/statement.h"
#include "app/sql/transaction.h"
#include "base/file_path.h"
+#include "base/histogram.h"
#include "base/logging.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
@@ -126,6 +127,27 @@ bool LoginDatabase::InitLoginsTable() {
return true;
}
+void LoginDatabase::ReportMetrics() {
+ sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE,
+ "SELECT signon_realm, COUNT(username_value) FROM logins "
+ "GROUP BY signon_realm"));
+ if (!s) {
+ NOTREACHED() << "Statement prepare failed";
+ return;
+ }
+
+ int total_accounts = 0;
+ while (s.Step()) {
+ int accounts_per_site = s.ColumnInt(1);
+ total_accounts += accounts_per_site;
+ UMA_HISTOGRAM_CUSTOM_COUNTS("PasswordManager.AccountsPerSite",
+ accounts_per_site, 0, 32, 6);
+ }
+ UMA_HISTOGRAM_CUSTOM_COUNTS("PasswordManager.TotalAccounts",
+ total_accounts, 0, 32, 6);
+
+ return;
+}
bool LoginDatabase::AddLogin(const PasswordForm& form) {
// You *must* change LoginTableColumns if this query changes.
« no previous file with comments | « chrome/browser/password_manager/login_database.h ('k') | chrome/browser/password_manager/password_store_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698