summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/autofill_dialog_gtk.cc8
-rw-r--r--chrome/browser/autofill/credit_card.cc7
2 files changed, 12 insertions, 3 deletions
diff --git a/chrome/browser/autofill/autofill_dialog_gtk.cc b/chrome/browser/autofill/autofill_dialog_gtk.cc
index ebb4f9a..d3b82c0c0 100644
--- a/chrome/browser/autofill/autofill_dialog_gtk.cc
+++ b/chrome/browser/autofill/autofill_dialog_gtk.cc
@@ -1005,9 +1005,13 @@ void AutoFillDialog::AddCreditCard(const CreditCard& credit_card,
SetEntryText(widgets.label, credit_card.Label());
SetEntryText(widgets.name_on_card,
credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NAME)));
+ // Set obfuscated number if not empty.
+ string16 credit_card_number =
+ credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER));
+ if (!credit_card_number.empty())
+ credit_card_number = credit_card.ObfuscatedNumber();
// TODO(jhawkins): Credit Card type? Shouldn't be necessary.
- SetEntryText(widgets.card_number,
- credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER)));
+ SetEntryText(widgets.card_number, credit_card_number);
SetEntryText(widgets.expiration_month,
credit_card.GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)));
SetEntryText(
diff --git a/chrome/browser/autofill/credit_card.cc b/chrome/browser/autofill/credit_card.cc
index b412241..fefab77 100644
--- a/chrome/browser/autofill/credit_card.cc
+++ b/chrome/browser/autofill/credit_card.cc
@@ -13,6 +13,7 @@
#include "grit/generated_resources.h"
static const string16 kCreditCardSeparators = ASCIIToUTF16(" -");
+static const char* kCreditCardObfuscationString = "************";
static const AutoFillFieldType kAutoFillCreditCardTypes[] = {
CREDIT_CARD_NAME,
@@ -184,6 +185,10 @@ void CreditCard::SetInfo(const AutoFillType& type, const string16& value) {
break;
case CREDIT_CARD_NUMBER: {
+ if (StartsWith(value, ASCIIToUTF16(kCreditCardObfuscationString), true)) {
+ // this is an obfuscated string. Do not change the real value.
+ break;
+ }
set_number(value);
// Update last four digits as well.
if (value.length() > 4)
@@ -206,7 +211,7 @@ void CreditCard::SetInfo(const AutoFillType& type, const string16& value) {
string16 CreditCard::ObfuscatedNumber() const {
if (number().empty())
return string16(); // No CC number, means empty preview.
- string16 result(ASCIIToUTF16("************"));
+ string16 result(ASCIIToUTF16(kCreditCardObfuscationString));
result.append(last_four_digits());
return result;