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

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

Issue 873403004: Autofill - show expiration date in CVC prompt when card is expired. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" 9 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
(...skipping 30 matching lines...) Expand all
41 if (card_unmask_view_) 41 if (card_unmask_view_)
42 card_unmask_view_->GotVerificationResult(success); 42 card_unmask_view_->GotVerificationResult(success);
43 } 43 }
44 44
45 void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() { 45 void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() {
46 card_unmask_view_ = nullptr; 46 card_unmask_view_ = nullptr;
47 delegate_->OnUnmaskPromptClosed(); 47 delegate_->OnUnmaskPromptClosed();
48 } 48 }
49 49
50 void CardUnmaskPromptControllerImpl::OnUnmaskResponse( 50 void CardUnmaskPromptControllerImpl::OnUnmaskResponse(
51 const base::string16& cvc) { 51 const base::string16& cvc,
52 const base::string16& exp_month,
53 const base::string16& exp_year) {
52 card_unmask_view_->DisableAndWaitForVerification(); 54 card_unmask_view_->DisableAndWaitForVerification();
53 delegate_->OnUnmaskResponse(cvc); 55 delegate_->OnUnmaskResponse(cvc, exp_month, exp_year);
54 } 56 }
55 57
56 content::WebContents* CardUnmaskPromptControllerImpl::GetWebContents() { 58 content::WebContents* CardUnmaskPromptControllerImpl::GetWebContents() {
57 return web_contents_; 59 return web_contents_;
58 } 60 }
59 61
60 base::string16 CardUnmaskPromptControllerImpl::GetWindowTitle() const { 62 base::string16 CardUnmaskPromptControllerImpl::GetWindowTitle() const {
61 // TODO(estade): i18n. 63 // TODO(estade): i18n.
62 if (card_.GetServerStatus() == CreditCard::EXPIRED) { 64 if (ShouldRequestExpirationDate()) {
63 return base::ASCIIToUTF16("Update and verify your card ") + 65 return base::ASCIIToUTF16("Update and verify your card ") +
64 card_.TypeAndLastFourDigits(); 66 card_.TypeAndLastFourDigits();
65 } 67 }
66 68
67 return base::ASCIIToUTF16("Verify your card ") + 69 return base::ASCIIToUTF16("Verify your card ") +
68 card_.TypeAndLastFourDigits(); 70 card_.TypeAndLastFourDigits();
69 } 71 }
70 72
71 base::string16 CardUnmaskPromptControllerImpl::GetInstructionsMessage() const { 73 base::string16 CardUnmaskPromptControllerImpl::GetInstructionsMessage() const {
72 if (card_.GetServerStatus() == CreditCard::EXPIRED) { 74 if (ShouldRequestExpirationDate()) {
73 return l10n_util::GetStringUTF16( 75 return l10n_util::GetStringUTF16(
74 card_.type() == kAmericanExpressCard 76 card_.type() == kAmericanExpressCard
75 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_EXPIRED_AMEX 77 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_EXPIRED_AMEX
76 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_EXPIRED); 78 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_EXPIRED);
77 } 79 }
78 80
79 return l10n_util::GetStringUTF16( 81 return l10n_util::GetStringUTF16(
80 card_.type() == kAmericanExpressCard 82 card_.type() == kAmericanExpressCard
81 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_AMEX 83 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_AMEX
82 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS); 84 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS);
(...skipping 12 matching lines...) Expand all
95 const base::string16& input_text) const { 97 const base::string16& input_text) const {
96 base::string16 trimmed_text; 98 base::string16 trimmed_text;
97 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text); 99 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text);
98 size_t input_size = card_.type() == kAmericanExpressCard ? 4 : 3; 100 size_t input_size = card_.type() == kAmericanExpressCard ? 4 : 3;
99 return trimmed_text.size() == input_size && 101 return trimmed_text.size() == input_size &&
100 base::ContainsOnlyChars(trimmed_text, 102 base::ContainsOnlyChars(trimmed_text,
101 base::ASCIIToUTF16("0123456789")); 103 base::ASCIIToUTF16("0123456789"));
102 } 104 }
103 105
104 } // namespace autofill 106 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698