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

Side by Side Diff: components/payments/core/autofill_payment_instrument.cc

Issue 2844293002: [Payments] Handle clicking back on the CVC unmask dialog (Closed)
Patch Set: Test Created 3 years, 7 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
« no previous file with comments | « chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/payments/core/autofill_payment_instrument.h" 5 #include "components/payments/core/autofill_payment_instrument.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "components/autofill/core/browser/autofill_country.h" 10 #include "components/autofill/core/browser/autofill_country.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 DCHECK(delegate_); 106 DCHECK(delegate_);
107 credit_card_ = card; 107 credit_card_ = card;
108 cvc_ = cvc; 108 cvc_ = cvc;
109 is_waiting_for_card_unmask_ = false; 109 is_waiting_for_card_unmask_ = false;
110 110
111 if (!is_waiting_for_billing_address_normalization_) 111 if (!is_waiting_for_billing_address_normalization_)
112 GenerateBasicCardResponse(); 112 GenerateBasicCardResponse();
113 } 113 }
114 114
115 void AutofillPaymentInstrument::OnFullCardRequestFailed() { 115 void AutofillPaymentInstrument::OnFullCardRequestFailed() {
116 // TODO(anthonyvd): Do something with the error. 116 // The user may have cancelled the unmask or something has gone wrong (e.g.,
117 // the network request failed). In all cases, reset the |delegate_| so another
118 // request can start.
117 delegate_ = nullptr; 119 delegate_ = nullptr;
118 } 120 }
119 121
120 void AutofillPaymentInstrument::OnAddressNormalized( 122 void AutofillPaymentInstrument::OnAddressNormalized(
121 const autofill::AutofillProfile& normalized_profile) { 123 const autofill::AutofillProfile& normalized_profile) {
122 DCHECK(is_waiting_for_billing_address_normalization_); 124 DCHECK(is_waiting_for_billing_address_normalization_);
123 125
124 billing_address_ = normalized_profile; 126 billing_address_ = normalized_profile;
125 is_waiting_for_billing_address_normalization_ = false; 127 is_waiting_for_billing_address_normalization_ = false;
126 128
(...skipping 19 matching lines...) Expand all
146 .ToDictionaryValue(); 148 .ToDictionaryValue();
147 std::string stringified_details; 149 std::string stringified_details;
148 base::JSONWriter::Write(*response_value, &stringified_details); 150 base::JSONWriter::Write(*response_value, &stringified_details);
149 delegate_->OnInstrumentDetailsReady(method_name(), stringified_details); 151 delegate_->OnInstrumentDetailsReady(method_name(), stringified_details);
150 152
151 delegate_ = nullptr; 153 delegate_ = nullptr;
152 cvc_ = base::UTF8ToUTF16(""); 154 cvc_ = base::UTF8ToUTF16("");
153 } 155 }
154 156
155 } // namespace payments 157 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698