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

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

Issue 2740673002: Prepare Chromium and Blink for ICU 59 (Closed)
Patch Set: revert accidental revert of sftnly roll during rebase Created 3 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
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 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <ostream> 11 #include <ostream>
12 #include <string> 12 #include <string>
13 13
14 #include "base/guid.h" 14 #include "base/guid.h"
15 #include "base/i18n/time_formatting.h" 15 #include "base/i18n/time_formatting.h"
16 #include "base/i18n/unicodestring.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "base/metrics/histogram_macros.h" 19 #include "base/metrics/histogram_macros.h"
19 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
20 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_split.h" 22 #include "base/strings/string_split.h"
22 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
23 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
24 #include "base/time/time.h" 25 #include "base/time/time.h"
25 #include "build/build_config.h" 26 #include "build/build_config.h"
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 l10n::CaseInsensitiveCompare compare; 864 l10n::CaseInsensitiveCompare compare;
864 UErrorCode status = U_ZERO_ERROR; 865 UErrorCode status = U_ZERO_ERROR;
865 icu::Locale locale(app_locale.c_str()); 866 icu::Locale locale(app_locale.c_str());
866 icu::DateFormatSymbols date_format_symbols(locale, status); 867 icu::DateFormatSymbols date_format_symbols(locale, status);
867 DCHECK(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || 868 DCHECK(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING ||
868 status == U_USING_DEFAULT_WARNING); 869 status == U_USING_DEFAULT_WARNING);
869 870
870 int32_t num_months; 871 int32_t num_months;
871 const icu::UnicodeString* months = date_format_symbols.getMonths(num_months); 872 const icu::UnicodeString* months = date_format_symbols.getMonths(num_months);
872 for (int32_t i = 0; i < num_months; ++i) { 873 for (int32_t i = 0; i < num_months; ++i) {
873 const base::string16 icu_month(months[i].getBuffer(), months[i].length()); 874 const base::string16 icu_month(
875 base::i18n::UnicodeStringToString16(months[i]));
874 if (compare.StringsEqual(icu_month, month)) { 876 if (compare.StringsEqual(icu_month, month)) {
875 *num = i + 1; // Adjust from 0-indexed to 1-indexed. 877 *num = i + 1; // Adjust from 0-indexed to 1-indexed.
876 return true; 878 return true;
877 } 879 }
878 } 880 }
879 881
880 months = date_format_symbols.getShortMonths(num_months); 882 months = date_format_symbols.getShortMonths(num_months);
881 // Some abbreviations have . at the end (e.g., "janv." in French). We don't 883 // Some abbreviations have . at the end (e.g., "janv." in French). We don't
882 // care about matching that. 884 // care about matching that.
883 base::string16 trimmed_month; 885 base::string16 trimmed_month;
884 base::TrimString(month, ASCIIToUTF16("."), &trimmed_month); 886 base::TrimString(month, ASCIIToUTF16("."), &trimmed_month);
885 for (int32_t i = 0; i < num_months; ++i) { 887 for (int32_t i = 0; i < num_months; ++i) {
886 base::string16 icu_month(months[i].getBuffer(), months[i].length()); 888 base::string16 icu_month(base::i18n::UnicodeStringToString16(months[i]));
887 base::TrimString(icu_month, ASCIIToUTF16("."), &icu_month); 889 base::TrimString(icu_month, ASCIIToUTF16("."), &icu_month);
888 if (compare.StringsEqual(icu_month, trimmed_month)) { 890 if (compare.StringsEqual(icu_month, trimmed_month)) {
889 *num = i + 1; // Adjust from 0-indexed to 1-indexed. 891 *num = i + 1; // Adjust from 0-indexed to 1-indexed.
890 return true; 892 return true;
891 } 893 }
892 } 894 }
893 895
894 return false; 896 return false;
895 } 897 }
896 898
(...skipping 30 matching lines...) Expand all
927 const char kDinersCard[] = "dinersCC"; 929 const char kDinersCard[] = "dinersCC";
928 const char kDiscoverCard[] = "discoverCC"; 930 const char kDiscoverCard[] = "discoverCC";
929 const char kGenericCard[] = "genericCC"; 931 const char kGenericCard[] = "genericCC";
930 const char kJCBCard[] = "jcbCC"; 932 const char kJCBCard[] = "jcbCC";
931 const char kMasterCard[] = "masterCardCC"; 933 const char kMasterCard[] = "masterCardCC";
932 const char kMirCard[] = "mirCC"; 934 const char kMirCard[] = "mirCC";
933 const char kUnionPay[] = "unionPayCC"; 935 const char kUnionPay[] = "unionPayCC";
934 const char kVisaCard[] = "visaCC"; 936 const char kVisaCard[] = "visaCC";
935 937
936 } // namespace autofill 938 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_profile_comparator.cc ('k') | components/bookmarks/browser/titled_url_index.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698