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

Unified Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 106033007: Disable wallet in countries where it's not supported, take 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index 6ad59d1ec441132fe4bd4a6a273919cf28ab4f46..e11c6d3849cf828da409430a8634b27c1af8c210 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -682,6 +682,10 @@ bool PersonalDataManager::IsAutofillEnabled() const {
return pref_service_->GetBoolean(prefs::kAutofillEnabled);
}
+std::string PersonalDataManager::CountryCodeForCurrentTimezone() const {
+ return base::CountryCodeForCurrentTimezone();
+}
+
// static
bool PersonalDataManager::IsValidLearnableProfile(
const AutofillProfile& profile,
@@ -745,6 +749,23 @@ std::string PersonalDataManager::MergeProfile(
return guid;
}
+bool PersonalDataManager::IsCountryOfInterest(const std::string& country_code)
+ const {
+ DCHECK_EQ(2U, country_code.size());
Dan Beam 2014/01/02 22:10:39 nit: check that country_code is valid (not just 2
Evan Stade 2014/01/02 22:23:16 I think this is overkill, I was mainly just worrie
+
+ const std::vector<AutofillProfile*>& profiles = web_profiles();
Dan Beam 2014/01/02 22:10:39 ^ what about auxiliary profiles? (i.e. why not Get
Evan Stade 2014/01/02 22:23:16 because that causes mac to hang sometimes
Dan Beam 2014/01/02 22:30:37 this means we're ignoring additional data sources
Evan Stade 2014/01/02 22:36:15 yes, unfortunately.
+ std::list<std::string> country_codes;
+ for (size_t i = 0; i < profiles.size(); ++i) {
+ country_codes.push_back(StringToLowerASCII(UTF16ToASCII(
Dan Beam 2014/01/02 22:10:39 ^ all UTF conversion functions need to have base::
Evan Stade 2014/01/02 22:23:16 are you sure about that? These functions don't app
Dan Beam 2014/01/02 22:30:37 i'll let you and the compiler reconcile this.
Dan Beam 2014/01/02 22:35:27 nvm, yep, sorry, avi@ didn't change this
+ profiles[i]->GetRawInfo(ADDRESS_HOME_COUNTRY))));
+ }
+ country_codes.push_back(StringToLowerASCII(
+ CountryCodeForCurrentTimezone()));
+
+ return std::find(country_codes.begin(), country_codes.end(),
+ StringToLowerASCII(country_code)) != country_codes.end();
+}
+
const std::string& PersonalDataManager::GetDefaultCountryCodeForNewAddress()
const {
if (default_country_code_.empty())
@@ -752,7 +773,7 @@ const std::string& PersonalDataManager::GetDefaultCountryCodeForNewAddress()
// Failing that, guess based on system timezone.
if (default_country_code_.empty())
- default_country_code_ = base::CountryCodeForCurrentTimezone();
+ default_country_code_ = CountryCodeForCurrentTimezone();
// Failing that, guess based on locale.
if (default_country_code_.empty())

Powered by Google App Engine
This is Rietveld 408576698