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

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

Issue 296593003: Make various string_util functions take StringPieces instead of char[]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resync Created 6 years, 6 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>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 CreditCard::CreditCard(const CreditCard& credit_card) 127 CreditCard::CreditCard(const CreditCard& credit_card)
128 : AutofillDataModel(std::string(), std::string()) { 128 : AutofillDataModel(std::string(), std::string()) {
129 operator=(credit_card); 129 operator=(credit_card);
130 } 130 }
131 131
132 CreditCard::~CreditCard() {} 132 CreditCard::~CreditCard() {}
133 133
134 // static 134 // static
135 const base::string16 CreditCard::StripSeparators(const base::string16& number) { 135 const base::string16 CreditCard::StripSeparators(const base::string16& number) {
136 const base::char16 kSeparators[] = {'-', ' ', '\0'};
137 base::string16 stripped; 136 base::string16 stripped;
138 base::RemoveChars(number, kSeparators, &stripped); 137 base::RemoveChars(number, base::ASCIIToUTF16("- "), &stripped);
139 return stripped; 138 return stripped;
140 } 139 }
141 140
142 // static 141 // static
143 base::string16 CreditCard::TypeForDisplay(const std::string& type) { 142 base::string16 CreditCard::TypeForDisplay(const std::string& type) {
144 if (type == kAmericanExpressCard) 143 if (type == kAmericanExpressCard)
145 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_AMEX); 144 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_AMEX);
146 if (type == kDinersCard) 145 if (type == kDinersCard)
147 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_DINERS); 146 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_DINERS);
148 if (type == kDiscoverCard) 147 if (type == kDiscoverCard)
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 const char* const kAmericanExpressCard = "americanExpressCC"; 685 const char* const kAmericanExpressCard = "americanExpressCC";
687 const char* const kDinersCard = "dinersCC"; 686 const char* const kDinersCard = "dinersCC";
688 const char* const kDiscoverCard = "discoverCC"; 687 const char* const kDiscoverCard = "discoverCC";
689 const char* const kGenericCard = "genericCC"; 688 const char* const kGenericCard = "genericCC";
690 const char* const kJCBCard = "jcbCC"; 689 const char* const kJCBCard = "jcbCC";
691 const char* const kMasterCard = "masterCardCC"; 690 const char* const kMasterCard = "masterCardCC";
692 const char* const kUnionPay = "unionPayCC"; 691 const char* const kUnionPay = "unionPayCC";
693 const char* const kVisaCard = "visaCC"; 692 const char* const kVisaCard = "visaCC";
694 693
695 } // namespace autofill 694 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_profile.cc ('k') | components/autofill/core/browser/phone_number.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698