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

Unified Diff: components/infobars/core/infobar_container.cc

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typos Created 5 years 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: components/infobars/core/infobar_container.cc
diff --git a/components/infobars/core/infobar_container.cc b/components/infobars/core/infobar_container.cc
index 90ba064d4e0b6dca083a14c0e7c0c1589c5e166d..1ef6ba3125559080dd7a596c8deb8de1c3f02262 100644
--- a/components/infobars/core/infobar_container.cc
+++ b/components/infobars/core/infobar_container.cc
@@ -8,6 +8,9 @@
#include "base/auto_reset.h"
#include "base/logging.h"
+#include "base/metrics/histogram_base.h"
+#include "base/metrics/metrics_hashes.h"
+#include "base/metrics/sparse_histogram.h"
#include "build/build_config.h"
#include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_delegate.h"
@@ -152,6 +155,12 @@ void InfoBarContainer::AddInfoBar(InfoBar* infobar,
PlatformSpecificAddInfoBar(infobar, position);
infobar->set_container(this);
infobar->Show(animate);
+
+ // Record the infobar being displayed.
+ std::string id = infobar->delegate()->GetIdentifier();
+ int hashed_id =
+ static_cast<base::HistogramBase::Sample>(base::HashMetricName(id));
Peter Kasting 2015/12/14 23:59:14 Nit: Slightly shorter to just inline: int hashe
gone 2015/12/15 18:36:37 Done.
+ UMA_HISTOGRAM_SPARSE_SLOWLY("InfoBar.Added", hashed_id);
}
} // namespace infobars
« no previous file with comments | « components/autofill/core/browser/autofill_cc_infobar_delegate.cc ('k') | components/infobars/core/infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698