OLD | NEW |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 delegate_->OnUnmaskResponse(cvc, exp_month, exp_year); | 55 delegate_->OnUnmaskResponse(cvc, exp_month, exp_year); |
56 } | 56 } |
57 | 57 |
58 content::WebContents* CardUnmaskPromptControllerImpl::GetWebContents() { | 58 content::WebContents* CardUnmaskPromptControllerImpl::GetWebContents() { |
59 return web_contents_; | 59 return web_contents_; |
60 } | 60 } |
61 | 61 |
62 base::string16 CardUnmaskPromptControllerImpl::GetWindowTitle() const { | 62 base::string16 CardUnmaskPromptControllerImpl::GetWindowTitle() const { |
63 // TODO(estade): i18n. | 63 // TODO(estade): i18n. |
64 if (ShouldRequestExpirationDate()) { | 64 if (ShouldRequestExpirationDate()) { |
65 return base::ASCIIToUTF16("Update and verify your card ") + | 65 return base::ASCIIToUTF16("Update your card ") + |
66 card_.TypeAndLastFourDigits(); | 66 card_.TypeAndLastFourDigits(); |
67 } | 67 } |
68 | 68 |
69 return base::ASCIIToUTF16("Verify your card ") + | 69 return base::ASCIIToUTF16("Verify your card ") + |
70 card_.TypeAndLastFourDigits(); | 70 card_.TypeAndLastFourDigits(); |
71 } | 71 } |
72 | 72 |
73 base::string16 CardUnmaskPromptControllerImpl::GetInstructionsMessage() const { | 73 base::string16 CardUnmaskPromptControllerImpl::GetInstructionsMessage() const { |
74 if (ShouldRequestExpirationDate()) { | 74 if (ShouldRequestExpirationDate()) { |
75 return l10n_util::GetStringUTF16( | 75 return l10n_util::GetStringUTF16( |
76 card_.type() == kAmericanExpressCard | 76 card_.type() == kAmericanExpressCard |
(...skipping 20 matching lines...) Expand all Loading... |
97 const base::string16& input_text) const { | 97 const base::string16& input_text) const { |
98 base::string16 trimmed_text; | 98 base::string16 trimmed_text; |
99 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text); | 99 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text); |
100 size_t input_size = card_.type() == kAmericanExpressCard ? 4 : 3; | 100 size_t input_size = card_.type() == kAmericanExpressCard ? 4 : 3; |
101 return trimmed_text.size() == input_size && | 101 return trimmed_text.size() == input_size && |
102 base::ContainsOnlyChars(trimmed_text, | 102 base::ContainsOnlyChars(trimmed_text, |
103 base::ASCIIToUTF16("0123456789")); | 103 base::ASCIIToUTF16("0123456789")); |
104 } | 104 } |
105 | 105 |
106 } // namespace autofill | 106 } // namespace autofill |
OLD | NEW |