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 // TODO(jdonnelly): Log duration. | 1087 // If the upload succeeds, we will keep a copy of the card as a full server |
| 1088 // card on the device. |
| 1089 if (result == AutofillClient::SUCCESS && !server_id.empty()) { |
| 1090 upload_request_.card.set_record_type(CreditCard::FULL_SERVER_CARD); |
| 1091 upload_request_.card.SetServerStatus(CreditCard::OK); |
| 1092 upload_request_.card.set_server_id(server_id); |
| 1093 DCHECK(personal_data_); |
| 1094 if (personal_data_) |
| 1095 personal_data_->AddFullServerCreditCard(upload_request_.card); |
| 1096 } |
1088 } | 1097 } |
1089 | 1098 |
1090 void AutofillManager::OnFullCardRequestSucceeded(const CreditCard& card, | 1099 void AutofillManager::OnFullCardRequestSucceeded(const CreditCard& card, |
1091 const base::string16& cvc) { | 1100 const base::string16& cvc) { |
1092 credit_card_form_event_logger_->OnDidFillSuggestion(masked_card_); | 1101 credit_card_form_event_logger_->OnDidFillSuggestion(masked_card_); |
1093 FillCreditCardForm(unmasking_query_id_, unmasking_form_, unmasking_field_, | 1102 FillCreditCardForm(unmasking_query_id_, unmasking_form_, unmasking_field_, |
1094 card, cvc); | 1103 card, cvc); |
1095 masked_card_ = CreditCard(); | 1104 masked_card_ = CreditCard(); |
1096 } | 1105 } |
1097 | 1106 |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 } | 2259 } |
2251 #endif // ENABLE_FORM_DEBUG_DUMP | 2260 #endif // ENABLE_FORM_DEBUG_DUMP |
2252 | 2261 |
2253 void AutofillManager::LogCardUploadDecisionUkm( | 2262 void AutofillManager::LogCardUploadDecisionUkm( |
2254 AutofillMetrics::CardUploadDecisionMetric upload_decision) { | 2263 AutofillMetrics::CardUploadDecisionMetric upload_decision) { |
2255 AutofillMetrics::LogCardUploadDecisionUkm( | 2264 AutofillMetrics::LogCardUploadDecisionUkm( |
2256 client_->GetUkmService(), pending_upload_request_url_, upload_decision); | 2265 client_->GetUkmService(), pending_upload_request_url_, upload_decision); |
2257 } | 2266 } |
2258 | 2267 |
2259 } // namespace autofill | 2268 } // namespace autofill |
OLD | NEW |