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

Side by Side Diff: components/autofill/core/browser/credit_card.cc

Issue 165673007: Autofill Credit Card resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert for ios Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/credit_card.h" 5 #include "components/autofill/core/browser/credit_card.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <ostream> 10 #include <ostream>
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/guid.h" 14 #include "base/guid.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "components/autofill/core/browser/autofill_field.h" 22 #include "components/autofill/core/browser/autofill_field.h"
23 #include "components/autofill/core/browser/autofill_regexes.h" 23 #include "components/autofill/core/browser/autofill_regexes.h"
24 #include "components/autofill/core/browser/autofill_type.h" 24 #include "components/autofill/core/browser/autofill_type.h"
25 #include "components/autofill/core/browser/validation.h" 25 #include "components/autofill/core/browser/validation.h"
26 #include "components/autofill/core/common/form_field_data.h" 26 #include "components/autofill/core/common/form_field_data.h"
27 #include "grit/component_scaled_resources.h"
27 #include "grit/component_strings.h" 28 #include "grit/component_strings.h"
28 #include "third_party/icu/source/common/unicode/uloc.h" 29 #include "third_party/icu/source/common/unicode/uloc.h"
29 #include "third_party/icu/source/i18n/unicode/dtfmtsym.h" 30 #include "third_party/icu/source/i18n/unicode/dtfmtsym.h"
30 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
31 32
32 // TODO(blundell): Eliminate the need for this conditional include.
33 // crbug.com/328150
34 #if !defined(OS_IOS)
35 #include "grit/webkit_resources.h"
36 #endif
37
38 namespace autofill { 33 namespace autofill {
39 34
40 namespace { 35 namespace {
41 36
42 const base::char16 kCreditCardObfuscationSymbol = '*'; 37 const base::char16 kCreditCardObfuscationSymbol = '*';
43 38
44 // This is the maximum obfuscated symbols displayed. 39 // This is the maximum obfuscated symbols displayed.
45 // It is introduced to avoid rare cases where the credit card number is 40 // It is introduced to avoid rare cases where the credit card number is
46 // too large and fills the screen. 41 // too large and fills the screen.
47 const size_t kMaxObfuscationSize = 20; 42 const size_t kMaxObfuscationSize = 20;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_VISA); 157 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_VISA);
163 158
164 // If you hit this DCHECK, the above list of cases needs to be updated to 159 // If you hit this DCHECK, the above list of cases needs to be updated to
165 // include a new card. 160 // include a new card.
166 DCHECK_EQ(kGenericCard, type); 161 DCHECK_EQ(kGenericCard, type);
167 return base::string16(); 162 return base::string16();
168 } 163 }
169 164
170 // static 165 // static
171 int CreditCard::IconResourceId(const std::string& type) { 166 int CreditCard::IconResourceId(const std::string& type) {
172 // TODO(blundell): Either move these resources out of webkit_resources or 167 // TODO(blundell): Either move these resources out of webkit_resources or
blundell 2014/03/07 12:10:59 Hi Thiago, Sorry I hadn't noticed this before: Wo
tfarina 2014/03/07 14:37:42 Yes, but I will have to figure out why it has fail
173 // this function into //components/autofill/content/browser to eliminate the 168 // this function into //components/autofill/content/browser to eliminate the
174 // need for this ifdef-ing. crbug.com/328150 169 // need for this ifdef-ing. crbug.com/328150
175 #if defined(OS_IOS) 170 #if defined(OS_IOS)
176 return 0; 171 return 0;
177 #else 172 #else
178 if (type == kAmericanExpressCard) 173 if (type == kAmericanExpressCard)
179 return IDR_AUTOFILL_CC_AMEX; 174 return IDR_AUTOFILL_CC_AMEX;
180 if (type == kDinersCard) 175 if (type == kDinersCard)
181 return IDR_AUTOFILL_CC_DINERS; 176 return IDR_AUTOFILL_CC_DINERS;
182 if (type == kDiscoverCard) 177 if (type == kDiscoverCard)
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 const char* const kAmericanExpressCard = "americanExpressCC"; 693 const char* const kAmericanExpressCard = "americanExpressCC";
699 const char* const kDinersCard = "dinersCC"; 694 const char* const kDinersCard = "dinersCC";
700 const char* const kDiscoverCard = "discoverCC"; 695 const char* const kDiscoverCard = "discoverCC";
701 const char* const kGenericCard = "genericCC"; 696 const char* const kGenericCard = "genericCC";
702 const char* const kJCBCard = "jcbCC"; 697 const char* const kJCBCard = "jcbCC";
703 const char* const kMasterCard = "masterCardCC"; 698 const char* const kMasterCard = "masterCardCC";
704 const char* const kUnionPay = "unionPayCC"; 699 const char* const kUnionPay = "unionPayCC";
705 const char* const kVisaCard = "visaCC"; 700 const char* const kVisaCard = "visaCC";
706 701
707 } // namespace autofill 702 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/browser/wallet/wallet_items.cc ('k') | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698