Index: components/search_engines/template_url_prepopulate_data.cc |
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc |
index e63a58c0cb62097a8d54a21ea9e8078818acac7e..578224237964963847b82db6a744596245f74e86 100644 |
--- a/components/search_engines/template_url_prepopulate_data.cc |
+++ b/components/search_engines/template_url_prepopulate_data.cc |
@@ -29,6 +29,10 @@ |
#include "base/mac/scoped_cftyperef.h" |
#endif |
+#if defined(OS_ANDROID) |
+#include "ui/base/l10n/l10n_util_android.h" |
+#endif |
+ |
namespace TemplateURLPrepopulateData { |
@@ -621,11 +625,13 @@ int GetCurrentCountryID() { |
#elif defined(OS_ANDROID) |
-// Initialized by InitCountryCode(). |
-int g_country_code_at_install = kCountryIDUnknown; |
- |
int GetCurrentCountryID() { |
- return g_country_code_at_install; |
+ const std::string& country_code = l10n_util::GetDefaultCountryCode(); |
+ if (country_code.size() != 2) { |
+ return kCountryIDUnknown; |
+ } else { |
+ return CountryCharsToCountryIDWithUpdate(country_code[0], country_code[1]); |
+ } |
} |
#elif defined(OS_POSIX) |
@@ -1186,18 +1192,6 @@ bool SameDomain(const GURL& given_url, const GURL& prepopulated_url) { |
// Global functions ----------------------------------------------------------- |
-#if defined(OS_ANDROID) |
-void InitCountryCode(const std::string& country_code) { |
- if (country_code.size() != 2) { |
- DLOG(ERROR) << "Invalid country code: " << country_code; |
- g_country_code_at_install = kCountryIDUnknown; |
- } else { |
- g_country_code_at_install = |
- CountryCharsToCountryIDWithUpdate(country_code[0], country_code[1]); |
- } |
-} |
-#endif |
- |
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
registry->RegisterIntegerPref( |
prefs::kCountryIDAtInstall, |