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

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

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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
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/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <iterator> 9 #include <iterator>
10 10
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 785
786 std::vector<Suggestion> suggestions; 786 std::vector<Suggestion> suggestions;
787 // Match based on a prefix search. 787 // Match based on a prefix search.
788 std::vector<AutofillProfile*> matched_profiles; 788 std::vector<AutofillProfile*> matched_profiles;
789 for (AutofillProfile* profile : profiles) { 789 for (AutofillProfile* profile : profiles) {
790 base::string16 value = GetInfoInOneLine(profile, type, app_locale_); 790 base::string16 value = GetInfoInOneLine(profile, type, app_locale_);
791 if (value.empty()) 791 if (value.empty())
792 continue; 792 continue;
793 base::string16 value_canon = 793 base::string16 value_canon =
794 AutofillProfile::CanonicalizeProfileString(value); 794 AutofillProfile::CanonicalizeProfileString(value);
795 if (StartsWith(value_canon, field_contents_canon, true)) { 795 if (base::StartsWith(value_canon, field_contents_canon, true)) {
796 // Prefix match, add suggestion. 796 // Prefix match, add suggestion.
797 matched_profiles.push_back(profile); 797 matched_profiles.push_back(profile);
798 suggestions.push_back(Suggestion(value)); 798 suggestions.push_back(Suggestion(value));
799 suggestions.back().backend_id = profile->guid(); 799 suggestions.back().backend_id = profile->guid();
800 } 800 }
801 } 801 }
802 802
803 // Don't show two suggestions if one is a subset of the other. 803 // Don't show two suggestions if one is a subset of the other.
804 std::vector<AutofillProfile*> unique_matched_profiles; 804 std::vector<AutofillProfile*> unique_matched_profiles;
805 std::vector<Suggestion> unique_suggestions; 805 std::vector<Suggestion> unique_suggestions;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 // - the number matches any part of the card, or 859 // - the number matches any part of the card, or
860 // - it's a masked card and there are 6 or fewers typed so far. 860 // - it's a masked card and there are 6 or fewers typed so far.
861 // For other fields, require that the field contents match the beginning of 861 // For other fields, require that the field contents match the beginning of
862 // the stored data. 862 // the stored data.
863 if (type.GetStorableType() == CREDIT_CARD_NUMBER) { 863 if (type.GetStorableType() == CREDIT_CARD_NUMBER) {
864 if (creditcard_field_value.find(field_contents) == base::string16::npos && 864 if (creditcard_field_value.find(field_contents) == base::string16::npos &&
865 (credit_card->record_type() != CreditCard::MASKED_SERVER_CARD || 865 (credit_card->record_type() != CreditCard::MASKED_SERVER_CARD ||
866 field_contents.size() >= 6)) { 866 field_contents.size() >= 6)) {
867 continue; 867 continue;
868 } 868 }
869 } else if (!StartsWith(creditcard_field_value, field_contents, false)) { 869 } else if (!base::StartsWith(creditcard_field_value, field_contents,
870 false)) {
870 continue; 871 continue;
871 } 872 }
872 873
873 cards_to_suggest.push_back(credit_card); 874 cards_to_suggest.push_back(credit_card);
874 } 875 }
875 876
876 // De-dupe card suggestions. Full server cards shadow local cards, and 877 // De-dupe card suggestions. Full server cards shadow local cards, and
877 // local cards shadow masked server cards. 878 // local cards shadow masked server cards.
878 for (auto outer_it = cards_to_suggest.begin(); 879 for (auto outer_it = cards_to_suggest.begin();
879 outer_it != cards_to_suggest.end(); 880 outer_it != cards_to_suggest.end();
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 } 1327 }
1327 if (IsExperimentalWalletIntegrationEnabled() && 1328 if (IsExperimentalWalletIntegrationEnabled() &&
1328 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { 1329 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) {
1329 profiles_.insert( 1330 profiles_.insert(
1330 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); 1331 profiles_.end(), server_profiles_.begin(), server_profiles_.end());
1331 } 1332 }
1332 return profiles_; 1333 return profiles_;
1333 } 1334 }
1334 1335
1335 } // namespace autofill 1336 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/form_structure.cc ('k') | components/bookmarks/browser/bookmark_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698