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

Side by Side Diff: components/autofill/core/browser/payments/full_card_request.cc

Issue 2163693002: [Merge M-53] Credit card editor for PaymentRequest UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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 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
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() &&
79 (!response.exp_month.empty() || !response.exp_year.empty())) { 80 (!response.exp_month.empty() || !response.exp_year.empty())) {
80 personal_data_manager_->UpdateCreditCard(request_->card); 81 personal_data_manager_->UpdateCreditCard(request_->card);
81 } 82 }
82 83
83 if (!should_unmask_card_) { 84 if (!should_unmask_card_) {
84 if (delegate_) 85 if (delegate_)
85 delegate_->OnFullCardDetails(request_->card, response.cvc); 86 delegate_->OnFullCardDetails(request_->card, response.cvc);
86 Reset(); 87 Reset();
87 autofill_client_->OnUnmaskVerificationResult(AutofillClient::SUCCESS); 88 autofill_client_->OnUnmaskVerificationResult(AutofillClient::SUCCESS);
88 return; 89 return;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void FullCardRequest::Reset() { 158 void FullCardRequest::Reset() {
158 weak_ptr_factory_.InvalidateWeakPtrs(); 159 weak_ptr_factory_.InvalidateWeakPtrs();
159 payments_client_->CancelRequest(); 160 payments_client_->CancelRequest();
160 delegate_ = nullptr; 161 delegate_ = nullptr;
161 request_.reset(); 162 request_.reset();
162 should_unmask_card_ = false; 163 should_unmask_card_ = false;
163 } 164 }
164 165
165 } // namespace payments 166 } // namespace payments
166 } // namespace autofill 167 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/payments/full_card_request.h ('k') | components/autofill_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698