Index: components/autofill/core/browser/autofill_profile_comparator.cc |
diff --git a/components/autofill/core/browser/autofill_profile_comparator.cc b/components/autofill/core/browser/autofill_profile_comparator.cc |
index fd103d37c67ef6c1ebd02b588764414c1991c171..8bfcd193dd57301c2a31986505b1107fe2d354fa 100644 |
--- a/components/autofill/core/browser/autofill_profile_comparator.cc |
+++ b/components/autofill/core/browser/autofill_profile_comparator.cc |
@@ -10,7 +10,6 @@ |
#include "base/i18n/case_conversion.h" |
#include "base/i18n/char_iterator.h" |
#include "base/i18n/unicodestring.h" |
-#include "base/strings/string_piece.h" |
#include "base/strings/string_split.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversion_utils.h" |
@@ -668,7 +667,7 @@ std::set<base::string16> AutofillProfileComparator::GetNamePartVariants( |
const base::string16& name_part) { |
const size_t kMaxSupportedSubNames = 8; |
- std::vector<base::string16> sub_names = base::SplitString( |
+ std::vector<base::StringPiece16> sub_names = base::SplitStringPiece( |
name_part, kSpace, base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
// Limit the number of sub-names we support (to constrain memory usage); |
@@ -681,7 +680,7 @@ std::set<base::string16> AutofillProfileComparator::GetNamePartVariants( |
// For each sub-name, add a variant of all the already existing variants that |
// appends this sub-name and one that appends the initial of this sub-name. |
// Duplicates will be discarded when they're added to the variants set. |
- for (const base::string16& sub_name : sub_names) { |
+ for (const auto& sub_name : sub_names) { |
if (sub_name.empty()) |
continue; |
std::vector<base::string16> new_variants; |
@@ -697,7 +696,7 @@ std::set<base::string16> AutofillProfileComparator::GetNamePartVariants( |
// As a common case, also add the variant that just concatenates all of the |
// initials. |
base::string16 initials; |
- for (const base::string16& sub_name : sub_names) { |
+ for (const auto& sub_name : sub_names) { |
if (sub_name.empty()) |
continue; |
initials.push_back(sub_name[0]); |
@@ -721,12 +720,12 @@ bool AutofillProfileComparator::IsNameVariantOf( |
GetNamePartVariants(name_1_parts.given); |
const std::set<base::string16> middle_name_variants = |
GetNamePartVariants(name_1_parts.middle); |
- const base::string16& family_name = name_1_parts.family; |
+ base::StringPiece16 family_name = name_1_parts.family; |
// Iterate over all full name variants of profile 2 and see if any of them |
// match the full name from profile 1. |
- for (const base::string16& given_name : given_name_variants) { |
- for (const base::string16& middle_name : middle_name_variants) { |
+ for (const auto& given_name : given_name_variants) { |
+ for (const auto& middle_name : middle_name_variants) { |
base::string16 candidate = base::CollapseWhitespace( |
base::JoinString({given_name, middle_name, family_name}, kSpace), |
true); |