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

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

Issue 448853002: Move StringToLowerASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Try parsing the |month| as a number. 68 // Try parsing the |month| as a number.
69 if (base::StringToInt(month, num)) 69 if (base::StringToInt(month, num))
70 return true; 70 return true;
71 71
72 // If the locale is unknown, give up. 72 // If the locale is unknown, give up.
73 if (app_locale.empty()) 73 if (app_locale.empty())
74 return false; 74 return false;
75 75
76 // Otherwise, try parsing the |month| as a named month, e.g. "January" or 76 // Otherwise, try parsing the |month| as a named month, e.g. "January" or
77 // "Jan". 77 // "Jan".
78 base::string16 lowercased_month = StringToLowerASCII(month); 78 base::string16 lowercased_month = base::StringToLowerASCII(month);
79 79
80 UErrorCode status = U_ZERO_ERROR; 80 UErrorCode status = U_ZERO_ERROR;
81 icu::Locale locale(app_locale.c_str()); 81 icu::Locale locale(app_locale.c_str());
82 icu::DateFormatSymbols date_format_symbols(locale, status); 82 icu::DateFormatSymbols date_format_symbols(locale, status);
83 DCHECK(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || 83 DCHECK(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING ||
84 status == U_USING_DEFAULT_WARNING); 84 status == U_USING_DEFAULT_WARNING);
85 85
86 int32_t num_months; 86 int32_t num_months;
87 const icu::UnicodeString* months = date_format_symbols.getMonths(num_months); 87 const icu::UnicodeString* months = date_format_symbols.getMonths(num_months);
88 for (int32_t i = 0; i < num_months; ++i) { 88 for (int32_t i = 0; i < num_months; ++i) {
89 const base::string16 icu_month = base::string16(months[i].getBuffer(), 89 const base::string16 icu_month = base::string16(months[i].getBuffer(),
90 months[i].length()); 90 months[i].length());
91 if (lowercased_month == StringToLowerASCII(icu_month)) { 91 if (lowercased_month == base::StringToLowerASCII(icu_month)) {
92 *num = i + 1; // Adjust from 0-indexed to 1-indexed. 92 *num = i + 1; // Adjust from 0-indexed to 1-indexed.
93 return true; 93 return true;
94 } 94 }
95 } 95 }
96 96
97 months = date_format_symbols.getShortMonths(num_months); 97 months = date_format_symbols.getShortMonths(num_months);
98 for (int32_t i = 0; i < num_months; ++i) { 98 for (int32_t i = 0; i < num_months; ++i) {
99 const base::string16 icu_month = base::string16(months[i].getBuffer(), 99 const base::string16 icu_month = base::string16(months[i].getBuffer(),
100 months[i].length()); 100 months[i].length());
101 if (lowercased_month == StringToLowerASCII(icu_month)) { 101 if (lowercased_month == base::StringToLowerASCII(icu_month)) {
102 *num = i + 1; // Adjust from 0-indexed to 1-indexed. 102 *num = i + 1; // Adjust from 0-indexed to 1-indexed.
103 return true; 103 return true;
104 } 104 }
105 } 105 }
106 106
107 *num = 0; 107 *num = 0;
108 return false; 108 return false;
109 } 109 }
110 110
111 } // namespace 111 } // namespace
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 const char* const kAmericanExpressCard = "americanExpressCC"; 685 const char* const kAmericanExpressCard = "americanExpressCC";
686 const char* const kDinersCard = "dinersCC"; 686 const char* const kDinersCard = "dinersCC";
687 const char* const kDiscoverCard = "discoverCC"; 687 const char* const kDiscoverCard = "discoverCC";
688 const char* const kGenericCard = "genericCC"; 688 const char* const kGenericCard = "genericCC";
689 const char* const kJCBCard = "jcbCC"; 689 const char* const kJCBCard = "jcbCC";
690 const char* const kMasterCard = "masterCardCC"; 690 const char* const kMasterCard = "masterCardCC";
691 const char* const kUnionPay = "unionPayCC"; 691 const char* const kUnionPay = "unionPayCC";
692 const char* const kVisaCard = "visaCC"; 692 const char* const kVisaCard = "visaCC";
693 693
694 } // namespace autofill 694 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/contact_info.cc ('k') | components/autofill/core/browser/form_structure.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698