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

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

Issue 1280473002: Update ToLower/UpperASCII API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 return std::string(); 1306 return std::string();
1307 1307
1308 // Count up country codes from existing profiles. 1308 // Count up country codes from existing profiles.
1309 std::map<std::string, int> votes; 1309 std::map<std::string, int> votes;
1310 // TODO(estade): can we make this GetProfiles() instead? It seems to cause 1310 // TODO(estade): can we make this GetProfiles() instead? It seems to cause
1311 // errors in tests on mac trybots. See http://crbug.com/57221 1311 // errors in tests on mac trybots. See http://crbug.com/57221
1312 const std::vector<AutofillProfile*>& profiles = web_profiles(); 1312 const std::vector<AutofillProfile*>& profiles = web_profiles();
1313 std::vector<std::string> country_codes; 1313 std::vector<std::string> country_codes;
1314 AutofillCountry::GetAvailableCountries(&country_codes); 1314 AutofillCountry::GetAvailableCountries(&country_codes);
1315 for (size_t i = 0; i < profiles.size(); ++i) { 1315 for (size_t i = 0; i < profiles.size(); ++i) {
1316 std::string country_code = base::StringToUpperASCII(base::UTF16ToASCII( 1316 std::string country_code = base::ToUpperASCII(base::UTF16ToASCII(
1317 profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY))); 1317 profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY)));
1318 1318
1319 if (std::find(country_codes.begin(), country_codes.end(), country_code) != 1319 if (std::find(country_codes.begin(), country_codes.end(), country_code) !=
1320 country_codes.end()) { 1320 country_codes.end()) {
1321 // Verified profiles count 100x more than unverified ones. 1321 // Verified profiles count 100x more than unverified ones.
1322 votes[country_code] += profiles[i]->IsVerified() ? 100 : 1; 1322 votes[country_code] += profiles[i]->IsVerified() ? 100 : 1;
1323 } 1323 }
1324 } 1324 }
1325 1325
1326 // Take the most common country code. 1326 // Take the most common country code.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 } 1364 }
1365 if (IsExperimentalWalletIntegrationEnabled() && 1365 if (IsExperimentalWalletIntegrationEnabled() &&
1366 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { 1366 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) {
1367 profiles_.insert( 1367 profiles_.insert(
1368 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); 1368 profiles_.end(), server_profiles_.begin(), server_profiles_.end());
1369 } 1369 }
1370 return profiles_; 1370 return profiles_;
1371 } 1371 }
1372 1372
1373 } // namespace autofill 1373 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_country.cc ('k') | components/dom_distiller/core/viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698