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

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

Issue 1950203002: Cancel ongoing requests in full card requester. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « components/autofill/core/browser/autofill_manager.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 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 real_pan_request_timestamp_ = base::Time::Now(); 93 real_pan_request_timestamp_ = base::Time::Now();
94 payments_client_->UnmaskCard(*request_); 94 payments_client_->UnmaskCard(*request_);
95 } 95 }
96 } 96 }
97 97
98 void FullCardRequest::OnUnmaskPromptClosed() { 98 void FullCardRequest::OnUnmaskPromptClosed() {
99 if (delegate_) 99 if (delegate_)
100 delegate_->OnFullCardError(); 100 delegate_->OnFullCardError();
101 101
102 Reset(); 102 Reset();
103 payments_client_->CancelRequest();
104 } 103 }
105 104
106 void FullCardRequest::OnDidGetUnmaskRiskData(const std::string& risk_data) { 105 void FullCardRequest::OnDidGetUnmaskRiskData(const std::string& risk_data) {
107 request_->risk_data = risk_data; 106 request_->risk_data = risk_data;
108 if (!request_->user_response.cvc.empty()) { 107 if (!request_->user_response.cvc.empty()) {
109 real_pan_request_timestamp_ = base::Time::Now(); 108 real_pan_request_timestamp_ = base::Time::Now();
110 payments_client_->UnmaskCard(*request_); 109 payments_client_->UnmaskCard(*request_);
111 } 110 }
112 } 111 }
113 112
(...skipping 16 matching lines...) Expand all
130 } else { 129 } else {
131 if (delegate_) 130 if (delegate_)
132 delegate_->OnFullCardError(); 131 delegate_->OnFullCardError();
133 } 132 }
134 133
135 Reset(); 134 Reset();
136 autofill_client_->OnUnmaskVerificationResult(result); 135 autofill_client_->OnUnmaskVerificationResult(result);
137 } 136 }
138 137
139 void FullCardRequest::Reset() { 138 void FullCardRequest::Reset() {
139 weak_ptr_factory_.InvalidateWeakPtrs();
140 payments_client_->CancelRequest();
140 delegate_ = nullptr; 141 delegate_ = nullptr;
141 request_.reset(); 142 request_.reset();
142 should_unmask_card_ = false; 143 should_unmask_card_ = false;
143 } 144 }
144 145
145 } // namespace payments 146 } // namespace payments
146 } // namespace autofill 147 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698