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

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

Issue 23140005: Added of new UMA signals in order to be able to discover early if the "save password" feature gets … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review 9 Created 7 years, 3 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/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 f7c42bf88110d2718864d978996f9d8f2010a8d7..0e31df49326cbd71ef43a6e9f1907848e092688d 100644
--- a/chrome/browser/password_manager/password_manager_delegate_impl.cc
+++ b/chrome/browser/password_manager/password_manager_delegate_impl.cc
@@ -6,11 +6,14 @@
#include "base/memory/singleton.h"
#include "base/metrics/histogram.h"
+#include "base/strings/string_number_conversions.h"
vabr (Chromium) 2013/09/12 13:40:02 No longer needed?
jdomingos 2013/09/12 16:33:52 Done.
#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"
@@ -53,6 +56,11 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
NUM_RESPONSE_TYPES,
};
+ enum SavePasswordPromptDisplayedEnum {
+ SAVE_PASSWORD_PROMPT_DISPLAYED,
+ BOUNDARY_VALUE,
vabr (Chromium) 2013/09/12 13:40:02 I wonder what are the naming conventions. Should t
+ };
+
SavePasswordInfoBarDelegate(InfoBarService* infobar_service,
PasswordFormManager* form_to_save);
virtual ~SavePasswordInfoBarDelegate();
@@ -74,6 +82,13 @@ 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 group name corresponding to the domain name of |form_to_save_| if the
+ // form is on a monitored domain. Otherwise, an empty string.
+ const std::string uma_histogram_suffix_;
+
DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate);
};
@@ -105,12 +120,38 @@ SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate(
PasswordFormManager* form_to_save)
: ConfirmInfoBarDelegate(infobar_service),
form_to_save_(form_to_save),
- infobar_response_(NO_RESPONSE) {
+ infobar_response_(NO_RESPONSE),
+ uma_histogram_suffix_(password_manager_metrics_util::GroupIdToString(
+ password_manager_metrics_util::MonitoredDomainGroupId(
+ form_to_save->realm()))) {
+ if (!uma_histogram_suffix_.empty()) {
+ password_manager_metrics_util::LogUMAHistogramEnumeration(
+ "PasswordManager.SavePasswordPromptDisplayed" + uma_histogram_suffix_,
+ SAVE_PASSWORD_PROMPT_DISPLAYED,
+ BOUNDARY_VALUE);
+ }
}
SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() {
UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse",
infobar_response_, NUM_RESPONSE_TYPES);
+
+ // The shortest period (in ms) for which the prompt needs to
+ // live, so that we don't consider it killed prematurely, as might
+ // happen, e.g., if a pre-rendered page gets swapped in (and the
+ // current WebContents is destroyed).
+ const base::TimeDelta kMinimumPromptDisplayTimeMs =
vabr (Chromium) 2013/09/12 13:40:02 Now that this is a TimeDelta, you don't need the "
jdomingos 2013/09/12 16:33:52 Done.
+ base::TimeDelta::FromInternalValue(1000);
+
+ if (!uma_histogram_suffix_.empty()) {
+ password_manager_metrics_util::LogUMAHistogramEnumeration(
+ "PasswordManager.SavePasswordPromptResponse_" + uma_histogram_suffix_,
+ infobar_response_, NUM_RESPONSE_TYPES);
+ password_manager_metrics_util::LogUMAHistogramBoolean(
+ "PasswordManager.SavePasswordPromptDisappearedQuickly" +
+ uma_histogram_suffix_,
+ timer_.Elapsed() < kMinimumPromptDisplayTimeMs);
+ }
}
int SavePasswordInfoBarDelegate::GetIconID() const {

Powered by Google App Engine
This is Rietveld 408576698