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

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

Issue 870203002: Add status to server credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test updates Created 5 years, 11 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const base::string16& cvc) { 51 const base::string16& cvc) {
52 card_unmask_view_->DisableAndWaitForVerification(); 52 card_unmask_view_->DisableAndWaitForVerification();
53 delegate_->OnUnmaskResponse(cvc); 53 delegate_->OnUnmaskResponse(cvc);
54 } 54 }
55 55
56 content::WebContents* CardUnmaskPromptControllerImpl::GetWebContents() { 56 content::WebContents* CardUnmaskPromptControllerImpl::GetWebContents() {
57 return web_contents_; 57 return web_contents_;
58 } 58 }
59 59
60 base::string16 CardUnmaskPromptControllerImpl::GetWindowTitle() const { 60 base::string16 CardUnmaskPromptControllerImpl::GetWindowTitle() const {
61 return base::ASCIIToUTF16("Unlocking ") + card_.TypeAndLastFourDigits(); 61 if (card_.GetServerStatus() == CreditCard::EXPIRED) {
brettw 2015/01/26 06:02:26 Can we add a TODO for doing proper localizing? Or
Evan Stade 2015/01/26 19:41:16 TODO added. The reason I haven't added strings yet
62 return base::ASCIIToUTF16("Update and verify your card ") +
63 card_.TypeAndLastFourDigits();
64 }
65
66 return base::ASCIIToUTF16("Verify your card ") +
67 card_.TypeAndLastFourDigits();
62 } 68 }
63 69
64 base::string16 CardUnmaskPromptControllerImpl::GetInstructionsMessage() const { 70 base::string16 CardUnmaskPromptControllerImpl::GetInstructionsMessage() const {
71 if (card_.GetServerStatus() == CreditCard::EXPIRED) {
72 return l10n_util::GetStringUTF16(
73 card_.type() == kAmericanExpressCard
74 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_EXPIRED_AMEX
75 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_EXPIRED);
76 }
77
65 return l10n_util::GetStringUTF16( 78 return l10n_util::GetStringUTF16(
66 card_.type() == kAmericanExpressCard 79 card_.type() == kAmericanExpressCard
67 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_AMEX 80 ? IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS_AMEX
68 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS); 81 : IDS_AUTOFILL_CARD_UNMASK_PROMPT_INSTRUCTIONS);
69 } 82 }
70 83
71 int CardUnmaskPromptControllerImpl::GetCvcImageRid() const { 84 int CardUnmaskPromptControllerImpl::GetCvcImageRid() const {
72 return card_.type() == kAmericanExpressCard ? IDR_CREDIT_CARD_CVC_HINT_AMEX 85 return card_.type() == kAmericanExpressCard ? IDR_CREDIT_CARD_CVC_HINT_AMEX
73 : IDR_CREDIT_CARD_CVC_HINT; 86 : IDR_CREDIT_CARD_CVC_HINT;
74 } 87 }
75 88
89 bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const {
90 return card_.GetServerStatus() == CreditCard::EXPIRED;
91 }
92
76 bool CardUnmaskPromptControllerImpl::InputTextIsValid( 93 bool CardUnmaskPromptControllerImpl::InputTextIsValid(
77 const base::string16& input_text) const { 94 const base::string16& input_text) const {
78 base::string16 trimmed_text; 95 base::string16 trimmed_text;
79 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text); 96 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text);
80 size_t input_size = card_.type() == kAmericanExpressCard ? 4 : 3; 97 size_t input_size = card_.type() == kAmericanExpressCard ? 4 : 3;
81 return trimmed_text.size() == input_size && 98 return trimmed_text.size() == input_size &&
82 base::ContainsOnlyChars(trimmed_text, 99 base::ContainsOnlyChars(trimmed_text,
83 base::ASCIIToUTF16("0123456789")); 100 base::ASCIIToUTF16("0123456789"));
84 } 101 }
85 102
86 } // namespace autofill 103 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/card_unmask_prompt_controller_impl.h ('k') | components/autofill/core/browser/credit_card.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698