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

Side by Side Diff: components/autofill/core/browser/autofill_profile_comparator.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
« no previous file with comments | « chromeos/settings/timezone_settings.cc ('k') | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/autofill_profile_comparator.h" 5 #include "components/autofill/core/browser/autofill_profile_comparator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
11 #include "base/i18n/char_iterator.h" 11 #include "base/i18n/char_iterator.h"
12 #include "base/i18n/unicodestring.h"
12 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
13 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversion_utils.h" 16 #include "base/strings/utf_string_conversion_utils.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "components/autofill/core/browser/address_rewriter.h" 18 #include "components/autofill/core/browser/address_rewriter.h"
18 #include "components/autofill/core/browser/autofill_country.h" 19 #include "components/autofill/core/browser/autofill_country.h"
19 #include "components/autofill/core/browser/autofill_data_util.h" 20 #include "components/autofill/core/browser/autofill_data_util.h"
20 #include "components/autofill/core/browser/state_names.h" 21 #include "components/autofill/core/browser/state_names.h"
21 #include "third_party/libphonenumber/phonenumber_api.h" 22 #include "third_party/libphonenumber/phonenumber_api.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 122
122 // Trim off trailing whitespace if we left one. 123 // Trim off trailing whitespace if we left one.
123 if (previous_was_whitespace && !result.empty()) 124 if (previous_was_whitespace && !result.empty())
124 result.resize(result.size() - 1); 125 result.resize(result.size() - 1);
125 126
126 if (transliterator_ == nullptr) 127 if (transliterator_ == nullptr)
127 return result; 128 return result;
128 129
129 icu::UnicodeString value = icu::UnicodeString(result.data(), result.length()); 130 icu::UnicodeString value = icu::UnicodeString(result.data(), result.length());
130 transliterator_->transliterate(value); 131 transliterator_->transliterate(value);
131 return base::string16(value.getBuffer(), value.length()); 132 return base::i18n::UnicodeStringToString16(value);
132 } 133 }
133 134
134 bool AutofillProfileComparator::AreMergeable(const AutofillProfile& p1, 135 bool AutofillProfileComparator::AreMergeable(const AutofillProfile& p1,
135 const AutofillProfile& p2) const { 136 const AutofillProfile& p2) const {
136 // Sorted in order to relative expense of the tests to fail early and cheaply 137 // Sorted in order to relative expense of the tests to fail early and cheaply
137 // if possible. 138 // if possible.
138 DVLOG(1) << "Comparing profiles:\np1 = " << p1 << "\np2 = " << p2; 139 DVLOG(1) << "Comparing profiles:\np1 = " << p1 << "\np2 = " << p2;
139 140
140 if (!HaveMergeableEmailAddresses(p1, p2)) { 141 if (!HaveMergeableEmailAddresses(p1, p2)) {
141 DVLOG(1) << "Different email addresses."; 142 DVLOG(1) << "Different email addresses.";
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 const base::string16& address2 = rewriter.Rewrite(NormalizeForComparison( 951 const base::string16& address2 = rewriter.Rewrite(NormalizeForComparison(
951 p2.GetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), app_locale_))); 952 p2.GetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), app_locale_)));
952 if (CompareTokens(address1, address2) == DIFFERENT_TOKENS) { 953 if (CompareTokens(address1, address2) == DIFFERENT_TOKENS) {
953 return false; 954 return false;
954 } 955 }
955 956
956 return true; 957 return true;
957 } 958 }
958 959
959 } // namespace autofill 960 } // namespace autofill
OLDNEW
« no previous file with comments | « chromeos/settings/timezone_settings.cc ('k') | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698