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

Unified Diff: components/autofill/core/browser/autofill_data_util.cc

Issue 2844463004: Rename card 'type' into 'issuer network.' (Closed)
Patch Set: More iOS compile fix Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_data_util.cc
diff --git a/components/autofill/core/browser/autofill_data_util.cc b/components/autofill/core/browser/autofill_data_util.cc
index 80b15d2f020b7f4d1744a4fc1fde636b42db120e..092aa26fecc0f2b6e04e1fdacb5faf22f63d3dda 100644
--- a/components/autofill/core/browser/autofill_data_util.cc
+++ b/components/autofill/core/browser/autofill_data_util.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "base/i18n/char_iterator.h"
+#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -66,17 +67,16 @@ const char* common_cjk_multi_char_surnames[] = {
// Chinese, taken from the top 10 Chinese 2-character surnames:
// https://zh.wikipedia.org/wiki/%E8%A4%87%E5%A7%93#.E5.B8.B8.E8.A6.8B.E7.9A.84.E8.A4.87.E5.A7.93
// Simplified Chinese (mostly mainland China)
- "欧阳", "令狐", "皇甫", "上官", "司徒", "诸葛", "司马", "宇文", "呼延", "端木",
+ "欧阳", "令狐", "皇甫", "上官", "司徒", "诸葛", "司马", "宇文", "呼延",
+ "端木",
// Traditional Chinese (mostly Taiwan)
- "張簡", "歐陽", "諸葛", "申屠", "尉遲", "司馬", "軒轅", "夏侯"
-};
+ "張簡", "歐陽", "諸葛", "申屠", "尉遲", "司馬", "軒轅", "夏侯"};
// All Korean surnames that have more than one character, even the
// rare/ambiguous ones.
const char* korean_multi_char_surnames[] = {
- "강전", "남궁", "독고", "동방", "망절", "사공", "서문", "선우",
- "소봉", "어금", "장곡", "제갈", "황목", "황보"
-};
+ "강전", "남궁", "독고", "동방", "망절", "사공", "서문",
+ "선우", "소봉", "어금", "장곡", "제갈", "황목", "황보"};
// Returns true if |set| contains |element|, modulo a final period.
bool ContainsString(const char* const set[],
@@ -124,17 +124,18 @@ void StripSuffixes(std::vector<base::StringPiece16>* name_tokens) {
// Find whether |name| starts with any of the strings from the array
// |prefixes|. The returned value is the length of the prefix found, or 0 if
// none is found.
-size_t StartsWithAny(base::StringPiece16 name, const char** prefixes,
+size_t StartsWithAny(base::StringPiece16 name,
+ const char** prefixes,
size_t prefix_count) {
- base::string16 buffer;
- for (size_t i = 0; i < prefix_count; i++) {
- buffer.clear();
- base::UTF8ToUTF16(prefixes[i], strlen(prefixes[i]), &buffer);
- if (base::StartsWith(name, buffer, base::CompareCase::SENSITIVE)) {
- return buffer.size();
- }
- }
- return 0;
+ base::string16 buffer;
+ for (size_t i = 0; i < prefix_count; i++) {
+ buffer.clear();
+ base::UTF8ToUTF16(prefixes[i], strlen(prefixes[i]), &buffer);
+ if (base::StartsWith(name, buffer, base::CompareCase::SENSITIVE)) {
+ return buffer.size();
+ }
+ }
+ return 0;
}
// Returns true if |c| is a CJK (Chinese, Japanese, Korean) character, for any
@@ -262,12 +263,12 @@ bool IsCJKName(base::StringPiece16 name) {
NameParts SplitName(base::StringPiece16 name) {
static const base::char16 kWordSeparators[] = {
- u' ', // ASCII space.
- u',', // ASCII comma.
- u'\u3000', // 'IDEOGRAPHIC SPACE' (U+3000).
- u'\u30FB', // 'KATAKANA MIDDLE DOT' (U+30FB).
- u'\u00B7', // 'MIDDLE DOT' (U+00B7).
- u'\0' // End of string.
+ u' ', // ASCII space.
+ u',', // ASCII comma.
+ u'\u3000', // 'IDEOGRAPHIC SPACE' (U+3000).
+ u'\u30FB', // 'KATAKANA MIDDLE DOT' (U+30FB).
+ u'\u00B7', // 'MIDDLE DOT' (U+00B7).
+ u'\0' // End of string.
};
std::vector<base::StringPiece16> name_tokens = base::SplitStringPiece(
name, kWordSeparators, base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
@@ -406,22 +407,23 @@ bool ProfileMatchesFullName(base::StringPiece16 full_name,
return false;
}
-const PaymentRequestData& GetPaymentRequestData(const std::string& type) {
+const PaymentRequestData& GetPaymentRequestData(
+ const std::string& issuer_network) {
for (const PaymentRequestData& data : kPaymentRequestData) {
- if (type == data.card_type)
+ if (issuer_network == data.issuer_network)
return data;
}
return kGenericPaymentRequestData;
}
-const char* GetCardTypeForBasicCardPaymentType(
- const std::string& basic_card_payment_type) {
+const char* GetIssuerNetworkForBasicCardIssuerNetwork(
+ const std::string& basic_card_issuer_network) {
for (const PaymentRequestData& data : kPaymentRequestData) {
- if (basic_card_payment_type == data.basic_card_payment_type) {
- return data.card_type;
+ if (basic_card_issuer_network == data.basic_card_issuer_network) {
+ return data.issuer_network;
}
}
- return kGenericPaymentRequestData.card_type;
+ return kGenericPaymentRequestData.issuer_network;
}
bool IsValidCountryCode(const std::string& country_code) {

Powered by Google App Engine
This is Rietveld 408576698