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

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

Issue 2656053002: NullStream
Patch Set: . Created 3 years, 10 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 | « base/time/time.h ('k') | media/blink/webmediaplayer_impl.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"
(...skipping 15 matching lines...) Expand all
26 26
27 namespace autofill { 27 namespace autofill {
28 namespace { 28 namespace {
29 29
30 const base::char16 kSpace[] = {L' ', L'\0'}; 30 const base::char16 kSpace[] = {L' ', L'\0'};
31 31
32 bool ContainsNewline(base::StringPiece16 text) { 32 bool ContainsNewline(base::StringPiece16 text) {
33 return text.find('\n') != base::StringPiece16::npos; 33 return text.find('\n') != base::StringPiece16::npos;
34 } 34 }
35 35
36 } // namespace
37
36 std::ostream& operator<<(std::ostream& os, 38 std::ostream& operator<<(std::ostream& os,
37 const ::i18n::phonenumbers::PhoneNumber& n) { 39 const ::i18n::phonenumbers::PhoneNumber& n) {
38 os << "country_code: " << n.country_code() << " " 40 os << "country_code: " << n.country_code() << " "
39 << "national_number: " << n.national_number(); 41 << "national_number: " << n.national_number();
40 if (n.has_extension()) 42 if (n.has_extension())
41 os << " extension: \"" << n.extension() << "\""; 43 os << " extension: \"" << n.extension() << "\"";
42 if (n.has_italian_leading_zero()) 44 if (n.has_italian_leading_zero())
43 os << " italian_leading_zero: " << n.italian_leading_zero(); 45 os << " italian_leading_zero: " << n.italian_leading_zero();
44 if (n.has_number_of_leading_zeros()) 46 if (n.has_number_of_leading_zeros())
45 os << " number_of_leading_zeros: " << n.number_of_leading_zeros(); 47 os << " number_of_leading_zeros: " << n.number_of_leading_zeros();
46 if (n.has_raw_input()) 48 if (n.has_raw_input())
47 os << " raw_input: \"" << n.raw_input() << "\""; 49 os << " raw_input: \"" << n.raw_input() << "\"";
48 return os; 50 return os;
49 } 51 }
50 52
51 } // namespace
52
53 AutofillProfileComparator::AutofillProfileComparator( 53 AutofillProfileComparator::AutofillProfileComparator(
54 const base::StringPiece& app_locale) 54 const base::StringPiece& app_locale)
55 : app_locale_(app_locale.data(), app_locale.size()) { 55 : app_locale_(app_locale.data(), app_locale.size()) {
56 // Use ICU transliteration to remove diacritics and fold case. 56 // Use ICU transliteration to remove diacritics and fold case.
57 // See http://userguide.icu-project.org/transforms/general 57 // See http://userguide.icu-project.org/transforms/general
58 UErrorCode status = U_ZERO_ERROR; 58 UErrorCode status = U_ZERO_ERROR;
59 std::unique_ptr<icu::Transliterator> transliterator( 59 std::unique_ptr<icu::Transliterator> transliterator(
60 icu::Transliterator::createInstance( 60 icu::Transliterator::createInstance(
61 "NFD; [:Nonspacing Mark:] Remove; Lower; NFC", UTRANS_FORWARD, 61 "NFD; [:Nonspacing Mark:] Remove; Lower; NFC", UTRANS_FORWARD,
62 status)); 62 status));
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 const base::string16& address2 = rewriter.Rewrite(NormalizeForComparison( 950 const base::string16& address2 = rewriter.Rewrite(NormalizeForComparison(
951 p2.GetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), app_locale_))); 951 p2.GetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), app_locale_)));
952 if (CompareTokens(address1, address2) == DIFFERENT_TOKENS) { 952 if (CompareTokens(address1, address2) == DIFFERENT_TOKENS) {
953 return false; 953 return false;
954 } 954 }
955 955
956 return true; 956 return true;
957 } 957 }
958 958
959 } // namespace autofill 959 } // namespace autofill
OLDNEW
« no previous file with comments | « base/time/time.h ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698