OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/payments/full_card_request.h" | 5 #include "components/autofill/core/browser/payments/full_card_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 void FullCardRequest::OnUnmaskResponse(const UnmaskResponse& response) { | 71 void FullCardRequest::OnUnmaskResponse(const UnmaskResponse& response) { |
72 if (!response.exp_month.empty()) | 72 if (!response.exp_month.empty()) |
73 request_->card.SetRawInfo(CREDIT_CARD_EXP_MONTH, response.exp_month); | 73 request_->card.SetRawInfo(CREDIT_CARD_EXP_MONTH, response.exp_month); |
74 | 74 |
75 if (!response.exp_year.empty()) | 75 if (!response.exp_year.empty()) |
76 request_->card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, response.exp_year); | 76 request_->card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, response.exp_year); |
77 | 77 |
78 if (request_->card.record_type() == CreditCard::LOCAL_CARD && | 78 if (request_->card.record_type() == CreditCard::LOCAL_CARD && |
79 !request_->card.guid().empty() && | |
80 (!response.exp_month.empty() || !response.exp_year.empty())) { | 79 (!response.exp_month.empty() || !response.exp_year.empty())) { |
81 personal_data_manager_->UpdateCreditCard(request_->card); | 80 personal_data_manager_->UpdateCreditCard(request_->card); |
82 } | 81 } |
83 | 82 |
84 if (!should_unmask_card_) { | 83 if (!should_unmask_card_) { |
85 if (delegate_) | 84 if (delegate_) |
86 delegate_->OnFullCardDetails(request_->card, response.cvc); | 85 delegate_->OnFullCardDetails(request_->card, response.cvc); |
87 Reset(); | 86 Reset(); |
88 autofill_client_->OnUnmaskVerificationResult(AutofillClient::SUCCESS); | 87 autofill_client_->OnUnmaskVerificationResult(AutofillClient::SUCCESS); |
89 return; | 88 return; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 void FullCardRequest::Reset() { | 157 void FullCardRequest::Reset() { |
159 weak_ptr_factory_.InvalidateWeakPtrs(); | 158 weak_ptr_factory_.InvalidateWeakPtrs(); |
160 payments_client_->CancelRequest(); | 159 payments_client_->CancelRequest(); |
161 delegate_ = nullptr; | 160 delegate_ = nullptr; |
162 request_.reset(); | 161 request_.reset(); |
163 should_unmask_card_ = false; | 162 should_unmask_card_ = false; |
164 } | 163 } |
165 | 164 |
166 } // namespace payments | 165 } // namespace payments |
167 } // namespace autofill | 166 } // namespace autofill |
OLD | NEW |