| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/autofill/core/browser/autofill_metrics.h" | 5 #include "components/autofill/core/browser/autofill_metrics.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 NUM_CONVERTED_ADDRESS_CONVERSION_TYPES); | 742 NUM_CONVERTED_ADDRESS_CONVERSION_TYPES); |
| 743 } | 743 } |
| 744 | 744 |
| 745 // static | 745 // static |
| 746 void AutofillMetrics::LogShowedHttpNotSecureExplanation() { | 746 void AutofillMetrics::LogShowedHttpNotSecureExplanation() { |
| 747 base::RecordAction( | 747 base::RecordAction( |
| 748 base::UserMetricsAction("Autofill_ShowedHttpNotSecureExplanation")); | 748 base::UserMetricsAction("Autofill_ShowedHttpNotSecureExplanation")); |
| 749 } | 749 } |
| 750 | 750 |
| 751 // static | 751 // static |
| 752 void AutofillMetrics::LogCardUploadDecisionUkm( | 752 void AutofillMetrics::LogCardUploadDecisionsUkm(ukm::UkmService* ukm_service, |
| 753 ukm::UkmService* ukm_service, | 753 const GURL& url, |
| 754 const GURL& url, | 754 int upload_decision_metrics) { |
| 755 AutofillMetrics::CardUploadDecisionMetric upload_decision) { | 755 DCHECK(upload_decision_metrics); |
| 756 if (upload_decision >= AutofillMetrics::NUM_CARD_UPLOAD_DECISION_METRICS) | 756 DCHECK_LT(upload_decision_metrics, 1 << NUM_CARD_UPLOAD_DECISION_METRICS); |
| 757 return; | |
| 758 | 757 |
| 759 const std::vector<std::pair<const char*, int>> metrics = { | 758 const std::vector<std::pair<const char*, int>> metrics = { |
| 760 {internal::kUKMCardUploadDecisionMetricName, | 759 {internal::kUKMCardUploadDecisionMetricName, upload_decision_metrics}}; |
| 761 static_cast<int>(upload_decision)}}; | |
| 762 LogUkm(ukm_service, url, internal::kUKMCardUploadDecisionEntryName, metrics); | 760 LogUkm(ukm_service, url, internal::kUKMCardUploadDecisionEntryName, metrics); |
| 763 } | 761 } |
| 764 | 762 |
| 765 // static | 763 // static |
| 766 void AutofillMetrics::LogDeveloperEngagementUkm( | 764 void AutofillMetrics::LogDeveloperEngagementUkm( |
| 767 ukm::UkmService* ukm_service, | 765 ukm::UkmService* ukm_service, |
| 768 const GURL& url, | 766 const GURL& url, |
| 769 std::vector<AutofillMetrics::DeveloperEngagementMetric> metrics) { | 767 int developer_engagement_metrics) { |
| 770 std::vector<std::pair<const char*, int>> form_structure_metrics; | 768 DCHECK(developer_engagement_metrics); |
| 771 for (const auto it : metrics) | 769 DCHECK_LT(developer_engagement_metrics, |
| 772 form_structure_metrics.push_back( | 770 1 << NUM_DEVELOPER_ENGAGEMENT_METRICS); |
| 773 {internal::kUKMDeveloperEngagementMetricName, static_cast<int>(it)}); | |
| 774 | 771 |
| 775 LogUkm(ukm_service, url, internal::kUKMDeveloperEngagementEntryName, | 772 const std::vector<std::pair<const char*, int>> metrics = { |
| 776 form_structure_metrics); | 773 {internal::kUKMDeveloperEngagementMetricName, |
| 774 developer_engagement_metrics}}; |
| 775 |
| 776 LogUkm(ukm_service, url, internal::kUKMDeveloperEngagementEntryName, metrics); |
| 777 } | 777 } |
| 778 | 778 |
| 779 // static | 779 // static |
| 780 bool AutofillMetrics::LogUkm( | 780 bool AutofillMetrics::LogUkm( |
| 781 ukm::UkmService* ukm_service, | 781 ukm::UkmService* ukm_service, |
| 782 const GURL& url, | 782 const GURL& url, |
| 783 const std::string& ukm_entry_name, | 783 const std::string& ukm_entry_name, |
| 784 const std::vector<std::pair<const char*, int>>& metrics) { | 784 const std::vector<std::pair<const char*, int>>& metrics) { |
| 785 if (!IsUkmLoggingEnabled() || !ukm_service || !url.is_valid() || | 785 if (!IsUkmLoggingEnabled() || !ukm_service || !url.is_valid() || |
| 786 metrics.empty()) { | 786 metrics.empty()) { |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 DCHECK(!form_loaded_timestamp_.is_null()); | 1151 DCHECK(!form_loaded_timestamp_.is_null()); |
| 1152 return (base::TimeTicks::Now() - form_loaded_timestamp_).InMilliseconds(); | 1152 return (base::TimeTicks::Now() - form_loaded_timestamp_).InMilliseconds(); |
| 1153 } | 1153 } |
| 1154 | 1154 |
| 1155 void AutofillMetrics::FormInteractionsUkmLogger::GetNewSourceID() { | 1155 void AutofillMetrics::FormInteractionsUkmLogger::GetNewSourceID() { |
| 1156 source_id_ = ukm_service_->GetNewSourceID(); | 1156 source_id_ = ukm_service_->GetNewSourceID(); |
| 1157 ukm_service_->UpdateSourceURL(source_id_, url_); | 1157 ukm_service_->UpdateSourceURL(source_id_, url_); |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 } // namespace autofill | 1160 } // namespace autofill |
| OLD | NEW |