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_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 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1074 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), | 1074 base::IgnoreResult(&PersonalDataManager::SaveImportedCreditCard), |
1075 base::Unretained(personal_data_), upload_request_.card)); | 1075 base::Unretained(personal_data_), upload_request_.card)); |
1076 AutofillMetrics::LogCardUploadDecisionMetric( | 1076 AutofillMetrics::LogCardUploadDecisionMetric( |
1077 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED); | 1077 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED); |
1078 LogCardUploadDecisionUkm( | 1078 LogCardUploadDecisionUkm( |
1079 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED); | 1079 AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED); |
1080 } | 1080 } |
1081 pending_upload_request_url_ = GURL(); | 1081 pending_upload_request_url_ = GURL(); |
1082 } | 1082 } |
1083 | 1083 |
1084 void AutofillManager::OnDidUploadCard( | 1084 void AutofillManager::OnDidUploadCard(AutofillClient::PaymentsRpcResult result, |
1085 AutofillClient::PaymentsRpcResult result) { | 1085 const std::string& server_id) { |
1086 // We don't do anything user-visible if the upload attempt fails. | 1086 // We don't do anything user-visible if the upload attempt fails. |
1087 // If the upload succeeds, we will keep a copy of the card as a full server | |
1088 // card on the device. | |
1087 // TODO(jdonnelly): Log duration. | 1089 // TODO(jdonnelly): Log duration. |
Mathieu
2017/04/24 18:11:55
we should either transform this into a TODO(crbug.
csashi
2017/04/24 18:30:06
Done.
| |
1090 if (result == AutofillClient::SUCCESS && !server_id.empty()) { | |
1091 upload_request_.card.set_record_type(CreditCard::FULL_SERVER_CARD); | |
1092 upload_request_.card.SetServerStatus(CreditCard::OK); | |
1093 upload_request_.card.set_server_id(server_id); | |
1094 DCHECK(personal_data_); | |
1095 if (personal_data_) | |
1096 personal_data_->AddServerCreditCard(upload_request_.card); | |
1097 } | |
1088 } | 1098 } |
1089 | 1099 |
1090 void AutofillManager::OnFullCardRequestSucceeded(const CreditCard& card, | 1100 void AutofillManager::OnFullCardRequestSucceeded(const CreditCard& card, |
1091 const base::string16& cvc) { | 1101 const base::string16& cvc) { |
1092 credit_card_form_event_logger_->OnDidFillSuggestion(masked_card_); | 1102 credit_card_form_event_logger_->OnDidFillSuggestion(masked_card_); |
1093 FillCreditCardForm(unmasking_query_id_, unmasking_form_, unmasking_field_, | 1103 FillCreditCardForm(unmasking_query_id_, unmasking_form_, unmasking_field_, |
1094 card, cvc); | 1104 card, cvc); |
1095 masked_card_ = CreditCard(); | 1105 masked_card_ = CreditCard(); |
1096 } | 1106 } |
1097 | 1107 |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2248 } | 2258 } |
2249 #endif // ENABLE_FORM_DEBUG_DUMP | 2259 #endif // ENABLE_FORM_DEBUG_DUMP |
2250 | 2260 |
2251 void AutofillManager::LogCardUploadDecisionUkm( | 2261 void AutofillManager::LogCardUploadDecisionUkm( |
2252 AutofillMetrics::CardUploadDecisionMetric upload_decision) { | 2262 AutofillMetrics::CardUploadDecisionMetric upload_decision) { |
2253 AutofillMetrics::LogCardUploadDecisionUkm( | 2263 AutofillMetrics::LogCardUploadDecisionUkm( |
2254 client_->GetUkmService(), pending_upload_request_url_, upload_decision); | 2264 client_->GetUkmService(), pending_upload_request_url_, upload_decision); |
2255 } | 2265 } |
2256 | 2266 |
2257 } // namespace autofill | 2267 } // namespace autofill |
OLD | NEW |