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

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

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/autofill_profile.h" 5 #include "components/autofill/core/browser/autofill_profile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include <ostream> 10 #include <ostream>
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 // of |this|. Likewise, ignore the compound "street address" type, as we 475 // of |this|. Likewise, ignore the compound "street address" type, as we
476 // are only interested in matching line-by-line. 476 // are only interested in matching line-by-line.
477 continue; 477 continue;
478 } else if (AutofillType(*it).group() == PHONE_HOME) { 478 } else if (AutofillType(*it).group() == PHONE_HOME) {
479 // Phone numbers should be canonicalized prior to being compared. 479 // Phone numbers should be canonicalized prior to being compared.
480 if (*it != PHONE_HOME_WHOLE_NUMBER) { 480 if (*it != PHONE_HOME_WHOLE_NUMBER) {
481 continue; 481 continue;
482 } else if (!i18n::PhoneNumbersMatch( 482 } else if (!i18n::PhoneNumbersMatch(
483 GetRawInfo(*it), 483 GetRawInfo(*it),
484 profile.GetRawInfo(*it), 484 profile.GetRawInfo(*it),
485 UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)), 485 base::UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)),
486 app_locale)) { 486 app_locale)) {
487 return false; 487 return false;
488 } 488 }
489 } else if (StringToLowerASCII(GetRawInfo(*it)) != 489 } else if (StringToLowerASCII(GetRawInfo(*it)) !=
490 StringToLowerASCII(profile.GetRawInfo(*it))) { 490 StringToLowerASCII(profile.GetRawInfo(*it))) {
491 return false; 491 return false;
492 } 492 }
493 } 493 }
494 494
495 return true; 495 return true;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 } 644 }
645 645
646 void AutofillProfile::AddPhoneIfUnique( 646 void AutofillProfile::AddPhoneIfUnique(
647 const base::string16& phone, 647 const base::string16& phone,
648 const std::string& app_locale, 648 const std::string& app_locale,
649 std::vector<base::string16>* existing_phones) { 649 std::vector<base::string16>* existing_phones) {
650 DCHECK(existing_phones); 650 DCHECK(existing_phones);
651 // Phones allow "fuzzy" matching, so "1-800-FLOWERS", "18003569377", 651 // Phones allow "fuzzy" matching, so "1-800-FLOWERS", "18003569377",
652 // "(800)356-9377" and "356-9377" are considered the same. 652 // "(800)356-9377" and "356-9377" are considered the same.
653 std::string country_code = UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)); 653 std::string country_code =
654 base::UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY));
654 if (std::find_if(existing_phones->begin(), existing_phones->end(), 655 if (std::find_if(existing_phones->begin(), existing_phones->end(),
655 FindByPhone(phone, country_code, app_locale)) == 656 FindByPhone(phone, country_code, app_locale)) ==
656 existing_phones->end()) { 657 existing_phones->end()) {
657 existing_phones->push_back(phone); 658 existing_phones->push_back(phone);
658 } 659 }
659 } 660 }
660 661
661 base::string16 AutofillProfile::ConstructInferredLabel( 662 base::string16 AutofillProfile::ConstructInferredLabel(
662 const std::vector<ServerFieldType>& included_fields, 663 const std::vector<ServerFieldType>& included_fields,
663 size_t num_fields_to_use) const { 664 size_t num_fields_to_use) const {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) 842 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP))
842 << " " 843 << " "
843 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) 844 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE))
844 << " " 845 << " "
845 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) 846 << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY))
846 << " " 847 << " "
847 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)); 848 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER));
848 } 849 }
849 850
850 } // namespace autofill 851 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/address.cc ('k') | components/autofill/core/browser/personal_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698