OLD | NEW |
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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 return guid; | 1054 return guid; |
1055 } | 1055 } |
1056 | 1056 |
1057 bool PersonalDataManager::IsCountryOfInterest(const std::string& country_code) | 1057 bool PersonalDataManager::IsCountryOfInterest(const std::string& country_code) |
1058 const { | 1058 const { |
1059 DCHECK_EQ(2U, country_code.size()); | 1059 DCHECK_EQ(2U, country_code.size()); |
1060 | 1060 |
1061 const std::vector<AutofillProfile*>& profiles = web_profiles(); | 1061 const std::vector<AutofillProfile*>& profiles = web_profiles(); |
1062 std::list<std::string> country_codes; | 1062 std::list<std::string> country_codes; |
1063 for (size_t i = 0; i < profiles.size(); ++i) { | 1063 for (size_t i = 0; i < profiles.size(); ++i) { |
1064 country_codes.push_back(base::StringToLowerASCII(base::UTF16ToASCII( | 1064 country_codes.push_back(base::ToLowerASCII(base::UTF16ToASCII( |
1065 profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY)))); | 1065 profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY)))); |
1066 } | 1066 } |
1067 | 1067 |
1068 std::string timezone_country = CountryCodeForCurrentTimezone(); | 1068 std::string timezone_country = CountryCodeForCurrentTimezone(); |
1069 if (!timezone_country.empty()) | 1069 if (!timezone_country.empty()) |
1070 country_codes.push_back(base::StringToLowerASCII(timezone_country)); | 1070 country_codes.push_back(base::ToLowerASCII(timezone_country)); |
1071 | 1071 |
1072 // Only take the locale into consideration if all else fails. | 1072 // Only take the locale into consideration if all else fails. |
1073 if (country_codes.empty()) { | 1073 if (country_codes.empty()) { |
1074 country_codes.push_back(base::StringToLowerASCII( | 1074 country_codes.push_back(base::ToLowerASCII( |
1075 AutofillCountry::CountryCodeForLocale(app_locale()))); | 1075 AutofillCountry::CountryCodeForLocale(app_locale()))); |
1076 } | 1076 } |
1077 | 1077 |
1078 return std::find(country_codes.begin(), country_codes.end(), | 1078 return std::find(country_codes.begin(), country_codes.end(), |
1079 base::StringToLowerASCII(country_code)) != | 1079 base::ToLowerASCII(country_code)) != country_codes.end(); |
1080 country_codes.end(); | |
1081 } | 1080 } |
1082 | 1081 |
1083 const std::string& PersonalDataManager::GetDefaultCountryCodeForNewAddress() | 1082 const std::string& PersonalDataManager::GetDefaultCountryCodeForNewAddress() |
1084 const { | 1083 const { |
1085 if (default_country_code_.empty()) | 1084 if (default_country_code_.empty()) |
1086 default_country_code_ = MostCommonCountryCodeFromProfiles(); | 1085 default_country_code_ = MostCommonCountryCodeFromProfiles(); |
1087 | 1086 |
1088 // Failing that, guess based on system timezone. | 1087 // Failing that, guess based on system timezone. |
1089 if (default_country_code_.empty()) | 1088 if (default_country_code_.empty()) |
1090 default_country_code_ = CountryCodeForCurrentTimezone(); | 1089 default_country_code_ = CountryCodeForCurrentTimezone(); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 } | 1363 } |
1365 if (IsExperimentalWalletIntegrationEnabled() && | 1364 if (IsExperimentalWalletIntegrationEnabled() && |
1366 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { | 1365 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { |
1367 profiles_.insert( | 1366 profiles_.insert( |
1368 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); | 1367 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); |
1369 } | 1368 } |
1370 return profiles_; | 1369 return profiles_; |
1371 } | 1370 } |
1372 | 1371 |
1373 } // namespace autofill | 1372 } // namespace autofill |
OLD | NEW |