Chromium Code Reviews| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 GROUP_CREDIT_CARD_NUMBER, | 72 GROUP_CREDIT_CARD_NUMBER, |
| 73 GROUP_CREDIT_CARD_DATE, | 73 GROUP_CREDIT_CARD_DATE, |
| 74 GROUP_CREDIT_CARD_TYPE, | 74 GROUP_CREDIT_CARD_TYPE, |
| 75 GROUP_PASSWORD, | 75 GROUP_PASSWORD, |
| 76 GROUP_ADDRESS_LINE_3, | 76 GROUP_ADDRESS_LINE_3, |
| 77 GROUP_USERNAME, | 77 GROUP_USERNAME, |
| 78 GROUP_STREET_ADDRESS, | 78 GROUP_STREET_ADDRESS, |
| 79 GROUP_CREDIT_CARD_VERIFICATION, | 79 GROUP_CREDIT_CARD_VERIFICATION, |
| 80 NUM_FIELD_TYPE_GROUPS_FOR_METRICS | 80 NUM_FIELD_TYPE_GROUPS_FOR_METRICS |
| 81 }; | 81 }; |
| 82 | 82 |
|
Jared Saul
2017/05/01 21:05:12
I have no idea what this is; can you please add a
csashi
2017/05/02 00:43:56
Seemed self-explanatory: https://cs.chromium.org/c
Jared Saul
2017/05/02 01:39:45
I think "previous" is what's throwing me off here,
csashi
2017/05/02 20:23:31
That is a good question, but is orthogonal to the
| |
| 83 std::string PreviousSaveCreditCardPromptUserDecisionToString( | 83 std::string PreviousSaveCreditCardPromptUserDecisionToString( |
| 84 int previous_save_credit_card_prompt_user_decision) { | 84 int previous_save_credit_card_prompt_user_decision) { |
| 85 DCHECK_LT(previous_save_credit_card_prompt_user_decision, | 85 DCHECK_LT(previous_save_credit_card_prompt_user_decision, |
| 86 prefs::NUM_PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISIONS); | 86 prefs::NUM_PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISIONS); |
| 87 std::string previous_response; | 87 std::string previous_response; |
| 88 if (previous_save_credit_card_prompt_user_decision == | 88 if (previous_save_credit_card_prompt_user_decision == |
| 89 prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED) | 89 prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED) |
| 90 previous_response = ".PreviouslyAccepted"; | 90 previous_response = ".PreviouslyAccepted"; |
| 91 else if (previous_save_credit_card_prompt_user_decision == | 91 else if (previous_save_credit_card_prompt_user_decision == |
| 92 prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED) | 92 prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED) |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 field_type_group_metric, | 303 field_type_group_metric, |
| 304 num_field_type_group_metrics); | 304 num_field_type_group_metrics); |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace | 307 } // namespace |
| 308 | 308 |
| 309 // static | 309 // static |
| 310 void AutofillMetrics::LogCardUploadDecisionMetric( | 310 void AutofillMetrics::LogCardUploadDecisionMetric( |
| 311 CardUploadDecisionMetric metric) { | 311 CardUploadDecisionMetric metric) { |
| 312 DCHECK_LT(metric, NUM_CARD_UPLOAD_DECISION_METRICS); | 312 DCHECK_LT(metric, NUM_CARD_UPLOAD_DECISION_METRICS); |
| 313 UMA_HISTOGRAM_ENUMERATION("Autofill.CardUploadDecisionExpanded", metric, | 313 UMA_HISTOGRAM_ENUMERATION("Autofill.CardUploadDecisionMetric", metric, |
| 314 NUM_CARD_UPLOAD_DECISION_METRICS); | 314 NUM_CARD_UPLOAD_DECISION_METRICS); |
| 315 } | 315 } |
| 316 | 316 |
| 317 // static | 317 // static |
| 318 void AutofillMetrics::LogCreditCardInfoBarMetric( | 318 void AutofillMetrics::LogCreditCardInfoBarMetric( |
| 319 InfoBarMetric metric, | 319 InfoBarMetric metric, |
| 320 bool is_uploading, | 320 bool is_uploading, |
| 321 int previous_save_credit_card_prompt_user_decision) { | 321 int previous_save_credit_card_prompt_user_decision) { |
| 322 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); | 322 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); |
| 323 | 323 |
| (...skipping 418 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 |