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

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2740633002: [Autofill] Add upstreaming UKM (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 upload_request_.context_token = context_token; 1032 upload_request_.context_token = context_token;
1033 user_did_accept_upload_prompt_ = false; 1033 user_did_accept_upload_prompt_ = false;
1034 client_->ConfirmSaveCreditCardToCloud( 1034 client_->ConfirmSaveCreditCardToCloud(
1035 upload_request_.card, std::move(legal_message), 1035 upload_request_.card, std::move(legal_message),
1036 base::Bind(&AutofillManager::OnUserDidAcceptUpload, 1036 base::Bind(&AutofillManager::OnUserDidAcceptUpload,
1037 weak_ptr_factory_.GetWeakPtr())); 1037 weak_ptr_factory_.GetWeakPtr()));
1038 client_->LoadRiskData(base::Bind(&AutofillManager::OnDidGetUploadRiskData, 1038 client_->LoadRiskData(base::Bind(&AutofillManager::OnDidGetUploadRiskData,
1039 weak_ptr_factory_.GetWeakPtr())); 1039 weak_ptr_factory_.GetWeakPtr()));
1040 AutofillMetrics::LogCardUploadDecisionMetric( 1040 AutofillMetrics::LogCardUploadDecisionMetric(
1041 AutofillMetrics::UPLOAD_OFFERED); 1041 AutofillMetrics::UPLOAD_OFFERED);
1042 personal_data_->LogCardUploadDecisionMetricUkm(
1043 AutofillMetrics::UPLOAD_OFFERED);
1042 } else { 1044 } else {
1043 // If the upload details request failed, fall back to a local save. The 1045 // If the upload details request failed, fall back to a local save. The
1044 // reasoning here is as follows: 1046 // reasoning here is as follows:
1045 // - This will sometimes fail intermittently, in which case it might be 1047 // - This will sometimes fail intermittently, in which case it might be
1046 // better to not fall back, because sometimes offering upload and sometimes 1048 // better to not fall back, because sometimes offering upload and sometimes
1047 // offering local save is a poor user experience. 1049 // offering local save is a poor user experience.
1048 // - However, in some cases, our local configuration limiting the feature to 1050 // - However, in some cases, our local configuration limiting the feature to
1049 // countries that Payments is known to support will not match Payments' own 1051 // countries that Payments is known to support will not match Payments' own
1050 // determination of what country the user is located in. In these cases, 1052 // determination of what country the user is located in. In these cases,
1051 // the upload details request will consistently fail and if we don't fall 1053 // the upload details request will consistently fail and if we don't fall
1052 // back to a local save then the user will never be offered any kind of 1054 // back to a local save then the user will never be offered any kind of
1053 // credit card save. 1055 // credit card save.
1054 client_->ConfirmSaveCreditCardLocally( 1056 client_->ConfirmSaveCreditCardLocally(
1055 upload_request_.card, 1057 upload_request_.card,
1056 base::Bind( 1058 base::Bind(
1057 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), 1059 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard),
1058 base::Unretained(personal_data_), upload_request_.card)); 1060 base::Unretained(personal_data_), upload_request_.card));
1059 AutofillMetrics::LogCardUploadDecisionMetric( 1061 AutofillMetrics::LogCardUploadDecisionMetric(
1060 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED); 1062 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED);
1063 personal_data_->LogCardUploadDecisionMetricUkm(
1064 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED);
1061 } 1065 }
Mathieu 2017/03/08 22:33:48 At this point I would call personal_data_->ResetUk
1062 } 1066 }
1063 1067
1064 void AutofillManager::OnDidUploadCard( 1068 void AutofillManager::OnDidUploadCard(
1065 AutofillClient::PaymentsRpcResult result) { 1069 AutofillClient::PaymentsRpcResult result) {
1066 // We don't do anything user-visible if the upload attempt fails. 1070 // We don't do anything user-visible if the upload attempt fails.
1067 // TODO(jdonnelly): Log duration. 1071 // TODO(jdonnelly): Log duration.
1068 } 1072 }
1069 1073
1070 void AutofillManager::OnFullCardRequestSucceeded(const CreditCard& card, 1074 void AutofillManager::OnFullCardRequestSucceeded(const CreditCard& card,
1071 const base::string16& cvc) { 1075 const base::string16& cvc) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 // Upload requires that recently used or modified addresses meet the 1214 // Upload requires that recently used or modified addresses meet the
1211 // client-side validation rules. 1215 // client-side validation rules.
1212 autofill::AutofillMetrics::CardUploadDecisionMetric 1216 autofill::AutofillMetrics::CardUploadDecisionMetric
1213 get_profiles_decision_metric = AutofillMetrics::UPLOAD_OFFERED; 1217 get_profiles_decision_metric = AutofillMetrics::UPLOAD_OFFERED;
1214 std::string rappor_metric_name; 1218 std::string rappor_metric_name;
1215 bool get_profiles_succeeded = 1219 bool get_profiles_succeeded =
1216 GetProfilesForCreditCardUpload(*imported_credit_card, 1220 GetProfilesForCreditCardUpload(*imported_credit_card,
1217 &upload_request_.profiles, 1221 &upload_request_.profiles,
1218 &get_profiles_decision_metric, 1222 &get_profiles_decision_metric,
1219 &rappor_metric_name); 1223 &rappor_metric_name);
1220 1224
Mathieu 2017/03/08 22:33:48 personal_data_->ResetUkmSession();
1225 personal_data_->SetCardUploadDecisionMetricUrlUkm(
1226 submitted_form.source_url());
1227
1221 // Both the CVC and address checks are done. Conform to the legacy order of 1228 // Both the CVC and address checks are done. Conform to the legacy order of
1222 // reporting on CVC then address. 1229 // reporting on CVC then address.
1223 if (upload_request_.cvc.empty()) { 1230 if (upload_request_.cvc.empty()) {
1224 AutofillMetrics::LogCardUploadDecisionMetric( 1231 AutofillMetrics::LogCardUploadDecisionMetric(
1225 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); 1232 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC);
1233 personal_data_->LogCardUploadDecisionMetricUkm(
1234 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC);
1226 CollectRapportSample(submitted_form.source_url(), 1235 CollectRapportSample(submitted_form.source_url(),
1227 "Autofill.CardUploadNotOfferedNoCvc"); 1236 "Autofill.CardUploadNotOfferedNoCvc");
1228 return; 1237 return;
1229 } 1238 }
1230 if (!get_profiles_succeeded) { 1239 if (!get_profiles_succeeded) {
1231 DCHECK(get_profiles_decision_metric != AutofillMetrics::UPLOAD_OFFERED); 1240 DCHECK(get_profiles_decision_metric != AutofillMetrics::UPLOAD_OFFERED);
1232 AutofillMetrics::LogCardUploadDecisionMetric( 1241 AutofillMetrics::LogCardUploadDecisionMetric(
1233 get_profiles_decision_metric); 1242 get_profiles_decision_metric);
1243 personal_data_->LogCardUploadDecisionMetricUkm(
1244 get_profiles_decision_metric);
1234 if (!rappor_metric_name.empty()) { 1245 if (!rappor_metric_name.empty()) {
1235 CollectRapportSample(submitted_form.source_url(), rappor_metric_name); 1246 CollectRapportSample(submitted_form.source_url(), rappor_metric_name);
1236 } 1247 }
1237 return; 1248 return;
1238 } 1249 }
1239 1250
1240 // All required data is available, start the upload process. 1251 // All required data is available, start the upload process.
1241 payments_client_->GetUploadDetails(upload_request_.profiles, app_locale_); 1252 payments_client_->GetUploadDetails(upload_request_.profiles, app_locale_);
1242 } 1253 }
1243 } 1254 }
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 if (i > 0) 2202 if (i > 0)
2192 fputs("Next oldest form:\n", file); 2203 fputs("Next oldest form:\n", file);
2193 } 2204 }
2194 fputs("\n", file); 2205 fputs("\n", file);
2195 2206
2196 fclose(file); 2207 fclose(file);
2197 } 2208 }
2198 #endif // ENABLE_FORM_DEBUG_DUMP 2209 #endif // ENABLE_FORM_DEBUG_DUMP
2199 2210
2200 } // namespace autofill 2211 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698