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

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

Issue 474483002: Revert 289312 "Move StringToUpperASCII and LowerCaseEqualsASCII ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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/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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // abandon the import. 282 // abandon the import.
283 if (!IsValidFieldTypeAndValue(types_seen, server_field_type, value)) { 283 if (!IsValidFieldTypeAndValue(types_seen, server_field_type, value)) {
284 imported_profile.reset(); 284 imported_profile.reset();
285 local_imported_credit_card.reset(); 285 local_imported_credit_card.reset();
286 break; 286 break;
287 } 287 }
288 288
289 types_seen.insert(server_field_type); 289 types_seen.insert(server_field_type);
290 290
291 if (group == CREDIT_CARD) { 291 if (group == CREDIT_CARD) {
292 if (base::LowerCaseEqualsASCII(field->form_control_type, "month")) { 292 if (LowerCaseEqualsASCII(field->form_control_type, "month")) {
293 DCHECK_EQ(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, server_field_type); 293 DCHECK_EQ(CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, server_field_type);
294 local_imported_credit_card->SetInfoForMonthInputType(value); 294 local_imported_credit_card->SetInfoForMonthInputType(value);
295 } else { 295 } else {
296 local_imported_credit_card->SetInfo(field_type, value, app_locale_); 296 local_imported_credit_card->SetInfo(field_type, value, app_locale_);
297 } 297 }
298 ++importable_credit_card_fields; 298 ++importable_credit_card_fields;
299 } else { 299 } else {
300 // We need to store phone data in the variables, before building the whole 300 // We need to store phone data in the variables, before building the whole
301 // number at the end. The rest of the fields are set "as is". 301 // number at the end. The rest of the fields are set "as is".
302 // If the fields are not the phone fields in question home.SetInfo() is 302 // If the fields are not the phone fields in question home.SetInfo() is
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 return std::string(); 1063 return std::string();
1064 1064
1065 // Count up country codes from existing profiles. 1065 // Count up country codes from existing profiles.
1066 std::map<std::string, int> votes; 1066 std::map<std::string, int> votes;
1067 // TODO(estade): can we make this GetProfiles() instead? It seems to cause 1067 // TODO(estade): can we make this GetProfiles() instead? It seems to cause
1068 // errors in tests on mac trybots. See http://crbug.com/57221 1068 // errors in tests on mac trybots. See http://crbug.com/57221
1069 const std::vector<AutofillProfile*>& profiles = web_profiles(); 1069 const std::vector<AutofillProfile*>& profiles = web_profiles();
1070 std::vector<std::string> country_codes; 1070 std::vector<std::string> country_codes;
1071 AutofillCountry::GetAvailableCountries(&country_codes); 1071 AutofillCountry::GetAvailableCountries(&country_codes);
1072 for (size_t i = 0; i < profiles.size(); ++i) { 1072 for (size_t i = 0; i < profiles.size(); ++i) {
1073 std::string country_code = base::StringToUpperASCII(base::UTF16ToASCII( 1073 std::string country_code = StringToUpperASCII(base::UTF16ToASCII(
1074 profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY))); 1074 profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY)));
1075 1075
1076 if (std::find(country_codes.begin(), country_codes.end(), country_code) != 1076 if (std::find(country_codes.begin(), country_codes.end(), country_code) !=
1077 country_codes.end()) { 1077 country_codes.end()) {
1078 // Verified profiles count 100x more than unverified ones. 1078 // Verified profiles count 100x more than unverified ones.
1079 votes[country_code] += profiles[i]->IsVerified() ? 100 : 1; 1079 votes[country_code] += profiles[i]->IsVerified() ? 100 : 1;
1080 } 1080 }
1081 } 1081 }
1082 1082
1083 // Take the most common country code. 1083 // Take the most common country code.
(...skipping 26 matching lines...) Expand all
1110 // Populates |auxiliary_profiles_|. 1110 // Populates |auxiliary_profiles_|.
1111 LoadAuxiliaryProfiles(record_metrics); 1111 LoadAuxiliaryProfiles(record_metrics);
1112 1112
1113 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); 1113 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end());
1114 profiles_.insert( 1114 profiles_.insert(
1115 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end()); 1115 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end());
1116 return profiles_; 1116 return profiles_;
1117 } 1117 }
1118 1118
1119 } // namespace autofill 1119 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698