summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 00:26:43 +0000
committerdpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 00:26:43 +0000
commit26199ae574cad50fa5ac8ab222daa60843d8308f (patch)
treee9daa3af58e2682b49235dd7eaf8c579cf657bfe /chrome
parenta9768f7049274a7e18504226fe411a562ca2fec3 (diff)
downloadchromium_src-26199ae574cad50fa5ac8ab222daa60843d8308f.zip
chromium_src-26199ae574cad50fa5ac8ab222daa60843d8308f.tar.gz
chromium_src-26199ae574cad50fa5ac8ab222daa60843d8308f.tar.bz2
Implement Password Manager aggregate metrics reporting
This patch implements UMA histograms for the total number of saved passwords and the number of usernames per site/realm. BUG=45946 R=jcivelli@chromium.org TEST=none Review URL: http://codereview.chromium.org/2834009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/password_manager/login_database.cc22
-rw-r--r--chrome/browser/password_manager/login_database.h3
-rw-r--r--chrome/browser/password_manager/password_store_default.cc1
-rw-r--r--chrome/browser/password_manager/password_store_mac.cc1
4 files changed, 27 insertions, 0 deletions
diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc
index d66135a..0c8d300 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.
diff --git a/chrome/browser/password_manager/login_database.h b/chrome/browser/password_manager/login_database.h
index 913fc17..44b868b 100644
--- a/chrome/browser/password_manager/login_database.h
+++ b/chrome/browser/password_manager/login_database.h
@@ -28,6 +28,9 @@ class LoginDatabase {
// If false is returned, no other method should be called.
bool Init(const FilePath& db_path);
+ // Reports usage metrics to UMA.
+ void ReportMetrics();
+
// Adds |form| to the list of remembered password forms.
bool AddLogin(const webkit_glue::PasswordForm& form);
diff --git a/chrome/browser/password_manager/password_store_default.cc b/chrome/browser/password_manager/password_store_default.cc
index 465f889..83909a7 100644
--- a/chrome/browser/password_manager/password_store_default.cc
+++ b/chrome/browser/password_manager/password_store_default.cc
@@ -35,6 +35,7 @@ PasswordStoreDefault::~PasswordStoreDefault() {
void PasswordStoreDefault::ReportMetricsImpl() {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
+ login_db_->ReportMetrics();
}
void PasswordStoreDefault::AddLoginImpl(const PasswordForm& form) {
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index 6571082..1804386 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -745,6 +745,7 @@ void PasswordStoreMac::ScheduleTask(Task* task) {
}
void PasswordStoreMac::ReportMetricsImpl() {
+ login_metadata_db_->ReportMetrics();
}
void PasswordStoreMac::AddLoginImpl(const PasswordForm& form) {