| Index: components/autofill/core/browser/autofill_metrics.cc
|
| diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc
|
| index 3300b672d536b6c2c3499ee8fe1a85f357048294..b8b103de5628415182d0d31ca1f215784300206f 100644
|
| --- a/components/autofill/core/browser/autofill_metrics.cc
|
| +++ b/components/autofill/core/browser/autofill_metrics.cc
|
| @@ -11,9 +11,11 @@
|
| #include "base/metrics/sparse_histogram.h"
|
| #include "base/metrics/user_metrics.h"
|
| #include "base/time/time.h"
|
| +#include "components/autofill/core/browser/autofill_experiments.h"
|
| #include "components/autofill/core/browser/autofill_type.h"
|
| #include "components/autofill/core/browser/form_structure.h"
|
| #include "components/autofill/core/common/form_data.h"
|
| +#include "components/ukm/ukm_entry_builder.h"
|
|
|
| namespace autofill {
|
|
|
| @@ -689,6 +691,28 @@ void AutofillMetrics::LogShowedHttpNotSecureExplanation() {
|
| base::UserMetricsAction("Autofill_ShowedHttpNotSecureExplanation"));
|
| }
|
|
|
| +// static
|
| +bool AutofillMetrics::LogUkm(ukm::UkmService* ukm_service,
|
| + const GURL& url,
|
| + const std::string& ukm,
|
| + const std::map<std::string, int>& metrics) {
|
| + if (!IsUkmLoggingEnabled() || !ukm_service || !url.is_valid() ||
|
| + metrics.empty()) {
|
| + return false;
|
| + }
|
| +
|
| + int32_t source_id = ukm_service->GetNewSourceID();
|
| + ukm_service->UpdateSourceURL(source_id, url);
|
| + std::unique_ptr<ukm::UkmEntryBuilder> builder =
|
| + ukm_service->GetEntryBuilder(source_id, ukm.c_str());
|
| +
|
| + for (auto it = metrics.begin(); it != metrics.end(); ++it) {
|
| + builder->AddMetric(it->first.c_str(), it->second);
|
| + }
|
| +
|
| + return true;
|
| +}
|
| +
|
| AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card)
|
| : is_for_credit_card_(is_for_credit_card),
|
| is_server_data_available_(false),
|
|
|