Index: chrome/browser/password_manager/password_manager_delegate_impl.cc |
diff --git a/chrome/browser/password_manager/password_manager_delegate_impl.cc b/chrome/browser/password_manager/password_manager_delegate_impl.cc |
index 95ce6b81ab845a42af0b2c5712b4be28dbc1b363..c0ebd3edb21bc499689dfa0189c7ddbd775e8681 100644 |
--- a/chrome/browser/password_manager/password_manager_delegate_impl.cc |
+++ b/chrome/browser/password_manager/password_manager_delegate_impl.cc |
@@ -7,10 +7,12 @@ |
#include "base/memory/singleton.h" |
#include "base/metrics/histogram.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "base/test/perftimer.h" |
#include "chrome/browser/infobars/confirm_infobar_delegate.h" |
#include "chrome/browser/infobars/infobar_service.h" |
#include "chrome/browser/password_manager/password_form_manager.h" |
#include "chrome/browser/password_manager/password_manager.h" |
+#include "chrome/browser/password_manager/password_manager_metrics_util.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/sync/one_click_signin_helper.h" |
#include "components/autofill/content/browser/autofill_driver_impl.h" |
@@ -74,6 +76,15 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate { |
// Used to track the results we get from the info bar. |
ResponseType infobar_response_; |
+ // Save password prompt lifetime needed for a UMA signal. |
+ PerfTimer timer_; |
+ |
+ // The |domain_name_| contained the current domain name prefixed with an |
+ // underscore when we are on a website for which we monitor |
+ // the save password prompt behaviour. Most of the time |
+ // it is empty. |
Ilya Sherman
2013/08/30 22:34:42
nit: I find this comment rather hard to parse. On
jdomingos
2013/09/02 09:58:45
Done.
|
+ std::string domain_name_; |
Ilya Sherman
2013/08/30 22:34:42
nit: Perhaps rename this to |monitored_domain_name
jdomingos
2013/09/02 09:58:45
Done.
|
+ |
DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate); |
}; |
@@ -106,11 +117,23 @@ SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( |
: ConfirmInfoBarDelegate(infobar_service), |
form_to_save_(form_to_save), |
infobar_response_(NO_RESPONSE) { |
+ domain_name_ = password_manager_metrics_util::IsDomainNameMonitored( |
+ form_to_save->realm()); |
+ if (domain_name_.size()) { |
Ilya Sherman
2013/08/30 22:34:42
nit: if (!domain_name_.empty())
jdomingos
2013/09/02 09:58:45
Done.
|
+ domain_name_.insert(0, "_"); |
Ilya Sherman
2013/08/30 22:34:42
Since all of the histogram logging code in this fi
jdomingos
2013/09/02 09:58:45
Done.
|
+ password_manager_metrics_util::LogUMAHistogramCount( |
+ "PasswordManager.InfobarDisplayed" + domain_name_, 1); |
+ } |
} |
SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { |
+ |
UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", |
infobar_response_, NUM_RESPONSE_TYPES); |
+ if (domain_name_.size()) { |
Ilya Sherman
2013/08/30 22:34:42
nit: if (!domain_name_.empty())
jdomingos
2013/09/02 09:58:45
Done.
|
+ password_manager_metrics_util::LogUMAHistogramTimes( |
+ "PasswordManager.InfoBarResponse" + domain_name_, timer_.Elapsed()); |
+ } |
} |
int SavePasswordInfoBarDelegate::GetIconID() const { |