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

Side by Side Diff: chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.cc

Issue 1132933004: Handle re-issued cards in unmasking prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky review Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.h" 5 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 10 matching lines...) Expand all
21 namespace autofill { 21 namespace autofill {
22 22
23 CardUnmaskPromptControllerImpl::CardUnmaskPromptControllerImpl( 23 CardUnmaskPromptControllerImpl::CardUnmaskPromptControllerImpl(
24 content::WebContents* web_contents, 24 content::WebContents* web_contents,
25 const RiskDataCallback& risk_data_callback, 25 const RiskDataCallback& risk_data_callback,
26 PrefService* pref_service, 26 PrefService* pref_service,
27 bool is_off_the_record) 27 bool is_off_the_record)
28 : web_contents_(web_contents), 28 : web_contents_(web_contents),
29 risk_data_callback_(risk_data_callback), 29 risk_data_callback_(risk_data_callback),
30 pref_service_(pref_service), 30 pref_service_(pref_service),
31 new_card_link_clicked_(false),
31 is_off_the_record_(is_off_the_record), 32 is_off_the_record_(is_off_the_record),
32 card_unmask_view_(nullptr), 33 card_unmask_view_(nullptr),
33 unmasking_result_(AutofillClient::NONE), 34 unmasking_result_(AutofillClient::NONE),
34 unmasking_initial_should_store_pan_(false), 35 unmasking_initial_should_store_pan_(false),
35 unmasking_number_of_attempts_(0), 36 unmasking_number_of_attempts_(0),
36 weak_pointer_factory_(this) { 37 weak_pointer_factory_(this) {
37 } 38 }
38 39
39 CardUnmaskPromptControllerImpl::~CardUnmaskPromptControllerImpl() { 40 CardUnmaskPromptControllerImpl::~CardUnmaskPromptControllerImpl() {
40 if (card_unmask_view_) 41 if (card_unmask_view_)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 prefs::kAutofillWalletImportStorageCheckboxState, should_store_pan); 203 prefs::kAutofillWalletImportStorageCheckboxState, should_store_pan);
203 } else { 204 } else {
204 DCHECK(!should_store_pan); 205 DCHECK(!should_store_pan);
205 pending_response_.should_store_pan = false; 206 pending_response_.should_store_pan = false;
206 } 207 }
207 208
208 if (!pending_response_.risk_data.empty()) 209 if (!pending_response_.risk_data.empty())
209 delegate_->OnUnmaskResponse(pending_response_); 210 delegate_->OnUnmaskResponse(pending_response_);
210 } 211 }
211 212
213 void CardUnmaskPromptControllerImpl::NewCardLinkClicked() {
214 new_card_link_clicked_ = true;
215 }
216
212 content::WebContents* CardUnmaskPromptControllerImpl::GetWebContents() { 217 content::WebContents* CardUnmaskPromptControllerImpl::GetWebContents() {
213 return web_contents_; 218 return web_contents_;
214 } 219 }
215 220
216 base::string16 CardUnmaskPromptControllerImpl::GetWindowTitle() const { 221 base::string16 CardUnmaskPromptControllerImpl::GetWindowTitle() const {
217 int ids = ShouldRequestExpirationDate() 222 int ids = ShouldRequestExpirationDate()
218 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_UPDATE_TITLE 223 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_UPDATE_TITLE
219 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_TITLE; 224 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_TITLE;
220 return l10n_util::GetStringFUTF16(ids, card_.TypeAndLastFourDigits()); 225 return l10n_util::GetStringFUTF16(ids, card_.TypeAndLastFourDigits());
221 } 226 }
(...skipping 11 matching lines...) Expand all
233 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_AMEX 238 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_AMEX
234 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS); 239 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS);
235 } 240 }
236 241
237 int CardUnmaskPromptControllerImpl::GetCvcImageRid() const { 242 int CardUnmaskPromptControllerImpl::GetCvcImageRid() const {
238 return card_.type() == kAmericanExpressCard ? IDR_CREDIT_CARD_CVC_HINT_AMEX 243 return card_.type() == kAmericanExpressCard ? IDR_CREDIT_CARD_CVC_HINT_AMEX
239 : IDR_CREDIT_CARD_CVC_HINT; 244 : IDR_CREDIT_CARD_CVC_HINT;
240 } 245 }
241 246
242 bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const { 247 bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const {
243 return card_.GetServerStatus() == CreditCard::EXPIRED; 248 return card_.GetServerStatus() == CreditCard::EXPIRED ||
249 new_card_link_clicked_;
244 } 250 }
245 251
246 bool CardUnmaskPromptControllerImpl::CanStoreLocally() const { 252 bool CardUnmaskPromptControllerImpl::CanStoreLocally() const {
247 // Never offer to save for incognito. 253 // Never offer to save for incognito.
248 if (is_off_the_record_) 254 if (is_off_the_record_)
249 return false; 255 return false;
250 return autofill::OfferStoreUnmaskedCards(); 256 return autofill::OfferStoreUnmaskedCards();
251 } 257 }
252 258
253 bool CardUnmaskPromptControllerImpl::GetStoreLocallyStartState() const { 259 bool CardUnmaskPromptControllerImpl::GetStoreLocallyStartState() const {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 320 }
315 321
316 void CardUnmaskPromptControllerImpl::OnDidLoadRiskFingerprint( 322 void CardUnmaskPromptControllerImpl::OnDidLoadRiskFingerprint(
317 const std::string& risk_data) { 323 const std::string& risk_data) {
318 pending_response_.risk_data = risk_data; 324 pending_response_.risk_data = risk_data;
319 if (!pending_response_.cvc.empty()) 325 if (!pending_response_.cvc.empty())
320 delegate_->OnUnmaskResponse(pending_response_); 326 delegate_->OnUnmaskResponse(pending_response_);
321 } 327 }
322 328
323 } // namespace autofill 329 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698