[Autofill] Rename {Get,Set}CanonicalizedInfo() to {Get,Set}Info(), and pass in the app locale.

Also:
* Pass the app locale to FormGroup::GetMatchingTypes(), FormGroup::GetNonEmptyTypes(), and CreditCard::UpdateFromImportedCard().
* Update PhoneNumber::GetRawInfo() to not rely on knowing the locale, and move all the code that depended on knowing the locale into PhoneNumber::GetInfo().
* Within the AutofillManager code, read the app locale on the UI thread, and pass it as a parameter to the worker thread.

BUG=100845
TEST=none (this is a refactoring change)

Review URL: https://chromiumcodereview.appspot.com/11417131

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171166 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/autofill/address.cc b/chrome/browser/autofill/address.cc
index c5e61ed..c1ed7acf 100644
--- a/chrome/browser/autofill/address.cc
+++ b/chrome/browser/autofill/address.cc
@@ -17,13 +17,6 @@
 
 const char16 kAddressSplitChars[] = {'-', ',', '#', '.', ' ', 0};
 
-// Returns the country code corresponding to |country|, which should be a
-// localized country name.
-std::string ToCountryCode(const string16& country) {
-  std::string app_locale = AutofillCountry::ApplicationLocale();
-  return AutofillCountry::GetCountryCode(country, app_locale);
-}
-
 }  // namespace
 
 Address::Address() {}
@@ -89,7 +82,12 @@
   else if (type == ADDRESS_HOME_STATE)
     state_ = value;
   else if (type == ADDRESS_HOME_COUNTRY)
-    country_code_ = ToCountryCode(value);
+    // TODO(isherman): When setting the country, it should only be possible to
+    // call this with a country code, which means we should be able to drop the
+    // call to GetCountryCode() below.
+    country_code_ =
+        AutofillCountry::GetCountryCode(value,
+                                        AutofillCountry::ApplicationLocale());
   else if (type == ADDRESS_HOME_ZIP)
     zip_code_ = value;
   else
@@ -97,11 +95,12 @@
 }
 
 void Address::GetMatchingTypes(const string16& text,
+                               const std::string& app_locale,
                                FieldTypeSet* matching_types) const {
-  FormGroup::GetMatchingTypes(text, matching_types);
+  FormGroup::GetMatchingTypes(text, app_locale, matching_types);
 
   // Check to see if the |text| canonicalized as a country name is a match.
-  std::string country_code = ToCountryCode(text);
+  std::string country_code = AutofillCountry::GetCountryCode(text, app_locale);
   if (!country_code.empty() && country_code_ == country_code)
     matching_types->insert(ADDRESS_HOME_COUNTRY);
 }
diff --git a/chrome/browser/autofill/address.h b/chrome/browser/autofill/address.h
index 44c50c60..a13b330 100644
--- a/chrome/browser/autofill/address.h
+++ b/chrome/browser/autofill/address.h
@@ -27,6 +27,7 @@
   virtual void SetRawInfo(AutofillFieldType type,
                           const string16& value) OVERRIDE;
   virtual void GetMatchingTypes(const string16& text,
+                                const std::string& app_locale,
                                 FieldTypeSet* matching_types) const OVERRIDE;
 
   const std::string& country_code() const { return country_code_; }
diff --git a/chrome/browser/autofill/address_unittest.cc b/chrome/browser/autofill/address_unittest.cc
index 5f4c883..9dcda2ab 100644
--- a/chrome/browser/autofill/address_unittest.cc
+++ b/chrome/browser/autofill/address_unittest.cc
@@ -108,7 +108,8 @@
   for (size_t i = 0; i < arraysize(kValidMatches); ++i) {
     SCOPED_TRACE(kValidMatches[i]);
     FieldTypeSet matching_types;
-    address.GetMatchingTypes(ASCIIToUTF16(kValidMatches[i]), &matching_types);
+    address.GetMatchingTypes(ASCIIToUTF16(kValidMatches[i]), "US",
+                             &matching_types);
     ASSERT_EQ(1U, matching_types.size());
     EXPECT_EQ(ADDRESS_HOME_COUNTRY, *matching_types.begin());
   }
@@ -119,7 +120,8 @@
   };
   for (size_t i = 0; i < arraysize(kInvalidMatches); ++i) {
     FieldTypeSet matching_types;
-    address.GetMatchingTypes(ASCIIToUTF16(kInvalidMatches[i]), &matching_types);
+    address.GetMatchingTypes(ASCIIToUTF16(kInvalidMatches[i]), "US",
+                             &matching_types);
     EXPECT_EQ(0U, matching_types.size());
   }
 
@@ -127,6 +129,6 @@
   address.set_country_code("");
   EXPECT_EQ(std::string(), address.country_code());
   FieldTypeSet matching_types;
-  address.GetMatchingTypes(ASCIIToUTF16("Garbage"), &matching_types);
+  address.GetMatchingTypes(ASCIIToUTF16("Garbage"), "US", &matching_types);
   EXPECT_EQ(0U, matching_types.size());
 }
diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc
index c01d997f..aa08f071 100644
--- a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc
+++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc
@@ -150,7 +150,7 @@
 
       // We need to store phone data in |phone| before building the whole number
       // at the end. The rest of the fields are set "as is".
-      // TODO(isherman): Call SetCanonicalizedInfo(), rather than SetRawInfo().
+      // TODO(isherman): Call SetInfo(), rather than SetRawInfo().
       if (!phone.SetInfo(it->second, field_value))
         profile->SetRawInfo(it->second, field_value);
     }
@@ -159,7 +159,7 @@
   string16 constructed_number;
   if (!phone.IsEmpty() &&
       phone.ParseNumber(std::string("US"), &constructed_number)) {
-    profile->SetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number);
+    profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number);
   }
 
   return has_non_empty_fields;
@@ -256,8 +256,7 @@
       RegKey key(HKEY_CURRENT_USER, key_name.c_str(), KEY_READ);
       CreditCard credit_card;
       if (ImportSingleProfile(&credit_card, &key, reg_to_field)) {
-        // TODO(isherman): Call into GetCanonicalizedInfo() below, rather than
-        // GetRawInfo().
+        // TODO(isherman): Call into GetInfo() below, rather than GetRawInfo().
         string16 cc_number = credit_card.GetRawInfo(CREDIT_CARD_NUMBER);
         if (!cc_number.empty())
           credit_cards->push_back(credit_card);
diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc
index e5c5b98..ace0867 100644
--- a/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc
+++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc
@@ -165,9 +165,10 @@
   EXPECT_EQ(profile1[2].value, profiles[1].GetRawInfo(NAME_LAST));
   EXPECT_EQ(profile1[3].value, profiles[1].GetRawInfo(EMAIL_ADDRESS));
   EXPECT_EQ(profile1[4].value, profiles[1].GetRawInfo(COMPANY_NAME));
-  EXPECT_EQ(profile1[7].value, profiles[1].GetRawInfo(PHONE_HOME_COUNTRY_CODE));
-  EXPECT_EQ(profile1[6].value, profiles[1].GetRawInfo(PHONE_HOME_CITY_CODE));
-  EXPECT_EQ(L"5555555", profiles[1].GetRawInfo(PHONE_HOME_NUMBER));
+  EXPECT_EQ(profile1[7].value,
+            profiles[1].GetInfo(PHONE_HOME_COUNTRY_CODE, "US"));
+  EXPECT_EQ(profile1[6].value, profiles[1].GetInfo(PHONE_HOME_CITY_CODE, "US"));
+  EXPECT_EQ(L"5555555", profiles[1].GetInfo(PHONE_HOME_NUMBER, "US"));
   EXPECT_EQ(L"+1 650-555-5555",
             profiles[1].GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
 
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 65c213b..7ef5323 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -25,6 +25,7 @@
 #include "chrome/browser/api/sync/profile_sync_service_base.h"
 #include "chrome/browser/autofill/autocomplete_history_manager.h"
 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
+#include "chrome/browser/autofill/autofill_country.h"
 #include "chrome/browser/autofill/autofill_external_delegate.h"
 #include "chrome/browser/autofill/autofill_field.h"
 #include "chrome/browser/autofill/autofill_manager_delegate.h"
@@ -143,6 +144,7 @@
 void DeterminePossibleFieldTypesForUpload(
     const std::vector<AutofillProfile>& profiles,
     const std::vector<CreditCard>& credit_cards,
+    const std::string& app_locale,
     FormStructure* submitted_form) {
   DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
 
@@ -155,11 +157,11 @@
     FieldTypeSet matching_types;
     for (std::vector<AutofillProfile>::const_iterator it = profiles.begin();
          it != profiles.end(); ++it) {
-      it->GetMatchingTypes(value, &matching_types);
+      it->GetMatchingTypes(value, app_locale, &matching_types);
     }
     for (std::vector<CreditCard>::const_iterator it = credit_cards.begin();
           it != credit_cards.end(); ++it) {
-      it->GetMatchingTypes(value, &matching_types);
+      it->GetMatchingTypes(value, app_locale, &matching_types);
     }
 
     if (matching_types.empty())
@@ -432,6 +434,7 @@
         base::Bind(&DeterminePossibleFieldTypesForUpload,
                    copied_profiles,
                    copied_credit_cards,
+                   AutofillCountry::ApplicationLocale(),
                    raw_submitted_form),
         base::Bind(&AutofillManager::UploadFormDataAsyncCallback,
                    this,
@@ -1106,6 +1109,7 @@
     std::vector<string16>* icons,
     std::vector<int>* unique_ids) const {
   const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles();
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
   if (!field.is_autofilled) {
     std::vector<AutofillProfile*> matched_profiles;
     for (std::vector<AutofillProfile*>::const_iterator iter = profiles.begin();
@@ -1114,7 +1118,7 @@
 
       // The value of the stored data for this field type in the |profile|.
       std::vector<string16> multi_values;
-      profile->GetCanonicalizedMultiInfo(type, &multi_values);
+      profile->GetMultiInfo(type, app_locale, &multi_values);
 
       for (size_t i = 0; i < multi_values.size(); ++i) {
         if (!multi_values[i].empty() &&
@@ -1146,7 +1150,7 @@
 
       // The value of the stored data for this field type in the |profile|.
       std::vector<string16> multi_values;
-      profile->GetCanonicalizedMultiInfo(type, &multi_values);
+      profile->GetMultiInfo(type, app_locale, &multi_values);
 
       for (size_t i = 0; i < multi_values.size(); ++i) {
         if (multi_values[i].empty())
@@ -1192,14 +1196,14 @@
     std::vector<string16>* labels,
     std::vector<string16>* icons,
     std::vector<int>* unique_ids) const {
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
   for (std::vector<CreditCard*>::const_iterator iter =
            personal_data_->credit_cards().begin();
        iter != personal_data_->credit_cards().end(); ++iter) {
     CreditCard* credit_card = *iter;
 
     // The value of the stored data for this field type in the |credit_card|.
-    string16 creditcard_field_value =
-        credit_card->GetCanonicalizedInfo(type);
+    string16 creditcard_field_value = credit_card->GetInfo(type, app_locale);
     if (!creditcard_field_value.empty() &&
         StartsWith(creditcard_field_value, field.value, false)) {
       if (type == CREDIT_CARD_NUMBER)
@@ -1208,7 +1212,7 @@
       string16 label;
       if (credit_card->number().empty()) {
         // If there is no CC number, return name to show something.
-        label = credit_card->GetCanonicalizedInfo(CREDIT_CARD_NAME);
+        label = credit_card->GetInfo(CREDIT_CARD_NAME, app_locale);
       } else {
         label = kCreditCardPrefix;
         label.append(credit_card->LastFourDigits());
diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc
index df9a9fa4..bd692ef8d 100644
--- a/chrome/browser/autofill/autofill_profile.cc
+++ b/chrome/browser/autofill/autofill_profile.cc
@@ -119,6 +119,14 @@
   return accumulate;
 }
 
+string16 GetFormGroupInfo(const FormGroup& form_group,
+                          AutofillFieldType type,
+                          const std::string& app_locale) {
+  return app_locale.empty() ?
+      form_group.GetRawInfo(type) :
+      form_group.GetInfo(type, app_locale);
+}
+
 template <class T>
 void CopyValuesToItems(AutofillFieldType type,
                        const std::vector<string16>& values,
@@ -137,14 +145,11 @@
 template <class T>
 void CopyItemsToValues(AutofillFieldType type,
                        const std::vector<T>& form_group_items,
-                       bool canonicalize,
+                       const std::string& app_locale,
                        std::vector<string16>* values) {
   values->resize(form_group_items.size());
   for (size_t i = 0; i < values->size(); ++i) {
-    if (canonicalize)
-      (*values)[i] = form_group_items[i].GetCanonicalizedInfo(type);
-    else
-      (*values)[i] = form_group_items[i].GetRawInfo(type);
+    (*values)[i] = GetFormGroupInfo(form_group_items[i], type, app_locale);
   }
 }
 
@@ -258,10 +263,11 @@
 }
 
 void AutofillProfile::GetMatchingTypes(const string16& text,
+                                       const std::string& app_locale,
                                        FieldTypeSet* matching_types) const {
   FormGroupList info = FormGroups();
   for (FormGroupList::const_iterator it = info.begin(); it != info.end(); ++it)
-    (*it)->GetMatchingTypes(text, matching_types);
+    (*it)->GetMatchingTypes(text, app_locale, matching_types);
 }
 
 string16 AutofillProfile::GetRawInfo(AutofillFieldType type) const {
@@ -280,24 +286,25 @@
     form_group->SetRawInfo(type, CollapseWhitespace(value, false));
 }
 
-string16 AutofillProfile::GetCanonicalizedInfo(AutofillFieldType type) const {
+string16 AutofillProfile::GetInfo(AutofillFieldType type,
+                                  const std::string& app_locale) const {
   AutofillFieldType return_type = AutofillType::GetEquivalentFieldType(type);
   const FormGroup* form_group = FormGroupForType(return_type);
   if (!form_group)
     return string16();
 
-  return form_group->GetCanonicalizedInfo(return_type);
+  return form_group->GetInfo(return_type, app_locale);
 }
 
-bool AutofillProfile::SetCanonicalizedInfo(AutofillFieldType type,
-                                           const string16& value) {
+bool AutofillProfile::SetInfo(AutofillFieldType type,
+                              const string16& value,
+                              const std::string& app_locale) {
   FormGroup* form_group = MutableFormGroupForType(type);
-  if (form_group) {
-    return form_group->SetCanonicalizedInfo(type,
-                                            CollapseWhitespace(value, false));
-  }
+  if (!form_group)
+    return false;
 
-  return false;
+  return
+      form_group->SetInfo(type, CollapseWhitespace(value, false), app_locale);
 }
 
 void AutofillProfile::SetRawMultiInfo(AutofillFieldType type,
@@ -330,12 +337,13 @@
 
 void AutofillProfile::GetRawMultiInfo(AutofillFieldType type,
                                       std::vector<string16>* values) const {
-  GetMultiInfoImpl(type, false, values);
+  GetMultiInfoImpl(type, std::string(), values);
 }
 
-void AutofillProfile::GetCanonicalizedMultiInfo(
-    AutofillFieldType type, std::vector<string16>* values) const {
-  GetMultiInfoImpl(type, true, values);
+void AutofillProfile::GetMultiInfo(AutofillFieldType type,
+                                   const std::string& app_locale,
+                                   std::vector<string16>* values) const {
+  GetMultiInfoImpl(type, app_locale, values);
 }
 
 void AutofillProfile::FillFormField(const AutofillField& field,
@@ -351,7 +359,7 @@
     FillSelectControl(type, field_data);
   } else {
     std::vector<string16> values;
-    GetCanonicalizedMultiInfo(type, &values);
+    GetMultiInfo(type, AutofillCountry::ApplicationLocale(), &values);
     if (variant >= values.size()) {
       // If the variant is unavailable, bail.  This case is reachable, for
       // example if Sync updates a profile during the filling process.
@@ -366,7 +374,7 @@
                                            size_t variant,
                                            FormFieldData* field_data) const {
   std::vector<string16> values;
-  GetCanonicalizedMultiInfo(field.type(), &values);
+  GetMultiInfo(field.type(), AutofillCountry::ApplicationLocale(), &values);
   DCHECK(variant < values.size());
 
   // If we are filling a phone number, check to see if the size field
@@ -402,7 +410,7 @@
 
 bool AutofillProfile::IsEmpty() const {
   FieldTypeSet types;
-  GetNonEmptyTypes(&types);
+  GetNonEmptyTypes(AutofillCountry::ApplicationLocale(), &types);
   return types.empty();
 }
 
@@ -461,7 +469,7 @@
 
 bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile) const {
   FieldTypeSet types;
-  GetNonEmptyTypes(&types);
+  GetNonEmptyTypes(AutofillCountry::ApplicationLocale(), &types);
 
   for (FieldTypeSet::const_iterator iter = types.begin(); iter != types.end();
        ++iter) {
@@ -491,7 +499,7 @@
 
 void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile) {
   FieldTypeSet field_types;
-  profile.GetNonEmptyTypes(&field_types);
+  profile.GetNonEmptyTypes(AutofillCountry::ApplicationLocale(), &field_types);
 
   // Only transfer "full" types (e.g. full name) and not fragments (e.g.
   // first name, last name).
@@ -635,21 +643,21 @@
 }
 
 void AutofillProfile::GetMultiInfoImpl(AutofillFieldType type,
-                                       bool canonicalize,
+                                       const std::string& app_locale,
                                        std::vector<string16>* values) const {
   switch (AutofillType(type).group()) {
     case AutofillType::NAME:
-      CopyItemsToValues(type, name_, canonicalize, values);
+      CopyItemsToValues(type, name_, app_locale, values);
       break;
     case AutofillType::EMAIL:
-      CopyItemsToValues(type, email_, canonicalize, values);
+      CopyItemsToValues(type, email_, app_locale, values);
       break;
     case AutofillType::PHONE:
-      CopyItemsToValues(type, home_number_, canonicalize, values);
+      CopyItemsToValues(type, home_number_, app_locale, values);
       break;
     default:
       values->resize(1);
-      (*values)[0] = GetRawInfo(type);
+      (*values)[0] = GetFormGroupInfo(*this, type, app_locale);
   }
 }
 
diff --git a/chrome/browser/autofill/autofill_profile.h b/chrome/browser/autofill/autofill_profile.h
index 921b831..e24d6f82 100644
--- a/chrome/browser/autofill/autofill_profile.h
+++ b/chrome/browser/autofill/autofill_profile.h
@@ -40,13 +40,16 @@
   // FormGroup:
   virtual std::string GetGUID() const OVERRIDE;
   virtual void GetMatchingTypes(const string16& text,
+                                const std::string& app_locale,
                                 FieldTypeSet* matching_types) const OVERRIDE;
   virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE;
   virtual void SetRawInfo(AutofillFieldType type,
                           const string16& value) OVERRIDE;
-  virtual string16 GetCanonicalizedInfo(AutofillFieldType type) const OVERRIDE;
-  virtual bool SetCanonicalizedInfo(AutofillFieldType type,
-                                    const string16& value) OVERRIDE;
+  virtual string16 GetInfo(AutofillFieldType type,
+                           const std::string& app_locale) const OVERRIDE;
+  virtual bool SetInfo(AutofillFieldType type,
+                       const string16& value,
+                       const std::string& app_locale) OVERRIDE;
   virtual void FillFormField(const AutofillField& field,
                              size_t variant,
                              FormFieldData* field_data) const OVERRIDE;
@@ -56,8 +59,9 @@
                        const std::vector<string16>& values);
   void GetRawMultiInfo(AutofillFieldType type,
                        std::vector<string16>* values) const;
-  void GetCanonicalizedMultiInfo(AutofillFieldType type,
-                                 std::vector<string16>* values) const;
+  void GetMultiInfo(AutofillFieldType type,
+                    const std::string& app_locale,
+                    std::vector<string16>* values) const;
 
   // Set |field_data|'s value for phone number based on contents of |this|.
   // The |field| specifies the type of the phone and whether this is a
@@ -148,9 +152,11 @@
   virtual bool FillCountrySelectControl(FormFieldData* field) const OVERRIDE;
   virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE;
 
-  // Shared implementation for GetMultiInfo() and GetCanonicalizedMultiInfo().
+  // Shared implementation for GetRawMultiInfo() and GetMultiInfo().  Pass an
+  // empty |app_locale| to get the raw info; otherwise, the returned info is
+  // canonicalized according to the given |app_locale|, if appropriate.
   void GetMultiInfoImpl(AutofillFieldType type,
-                        bool canonicalize,
+                        const std::string& app_locale,
                         std::vector<string16>* values) const;
 
   // Checks if the |phone| is in the |existing_phones| using fuzzy matching:
diff --git a/chrome/browser/autofill/credit_card.cc b/chrome/browser/autofill/credit_card.cc
index d3631eb..e78f74e 100644
--- a/chrome/browser/autofill/credit_card.cc
+++ b/chrome/browser/autofill/credit_card.cc
@@ -331,15 +331,17 @@
   }
 }
 
-string16 CreditCard::GetCanonicalizedInfo(AutofillFieldType type) const {
+string16 CreditCard::GetInfo(AutofillFieldType type,
+                             const std::string& app_locale) const {
   if (type == CREDIT_CARD_NUMBER)
     return StripSeparators(number_);
 
   return GetRawInfo(type);
 }
 
-bool CreditCard::SetCanonicalizedInfo(AutofillFieldType type,
-                                      const string16& value) {
+bool CreditCard::SetInfo(AutofillFieldType type,
+                         const string16& value,
+                         const std::string& app_locale) {
   if (type == CREDIT_CARD_NUMBER)
     SetRawInfo(type, StripSeparators(value));
   else
@@ -349,10 +351,11 @@
 }
 
 void CreditCard::GetMatchingTypes(const string16& text,
+                                  const std::string& app_locale,
                                   FieldTypeSet* matching_types) const {
-  FormGroup::GetMatchingTypes(text, matching_types);
+  FormGroup::GetMatchingTypes(text, app_locale, matching_types);
 
-  string16 card_number = GetCanonicalizedInfo(CREDIT_CARD_NUMBER);
+  string16 card_number = GetInfo(CREDIT_CARD_NUMBER, app_locale);
   if (!card_number.empty() && StripSeparators(text) == card_number)
     matching_types->insert(CREDIT_CARD_NUMBER);
 
@@ -433,9 +436,10 @@
   guid_ = credit_card.guid_;
 }
 
-bool CreditCard::UpdateFromImportedCard(const CreditCard& imported_card) {
-  if (this->GetCanonicalizedInfo(CREDIT_CARD_NUMBER) !=
-          imported_card.GetCanonicalizedInfo(CREDIT_CARD_NUMBER)) {
+bool CreditCard::UpdateFromImportedCard(const CreditCard& imported_card,
+                                        const std::string& app_locale) {
+  if (this->GetInfo(CREDIT_CARD_NUMBER, app_locale) !=
+          imported_card.GetInfo(CREDIT_CARD_NUMBER, app_locale)) {
     return false;
   }
 
@@ -459,19 +463,21 @@
   DCHECK_EQ(AutofillType::CREDIT_CARD, AutofillType(field.type()).group());
   DCHECK(field_data);
 
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
+
   if (field_data->form_control_type == "select-one") {
     FillSelectControl(field.type(), field_data);
   } else if (field_data->form_control_type == "month") {
     // HTML5 input="month" consists of year-month.
-    string16 year = GetCanonicalizedInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR);
-    string16 month = GetCanonicalizedInfo(CREDIT_CARD_EXP_MONTH);
+    string16 year = GetInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, app_locale);
+    string16 month = GetInfo(CREDIT_CARD_EXP_MONTH, app_locale);
     if (!year.empty() && !month.empty()) {
       // Fill the value only if |this| includes both year and month
       // information.
       field_data->value = year + ASCIIToUTF16("-") + month;
     }
   } else {
-    field_data->value = GetCanonicalizedInfo(field.type());
+    field_data->value = GetInfo(field.type(), app_locale);
   }
 }
 
@@ -542,7 +548,7 @@
 
 bool CreditCard::IsEmpty() const {
   FieldTypeSet types;
-  GetNonEmptyTypes(&types);
+  GetNonEmptyTypes(AutofillCountry::ApplicationLocale(), &types);
   return types.empty();
 }
 
diff --git a/chrome/browser/autofill/credit_card.h b/chrome/browser/autofill/credit_card.h
index 714a4c5..6a37438 100644
--- a/chrome/browser/autofill/credit_card.h
+++ b/chrome/browser/autofill/credit_card.h
@@ -28,13 +28,16 @@
   // FormGroup implementation:
   virtual std::string GetGUID() const OVERRIDE;
   virtual void GetMatchingTypes(const string16& text,
+                                const std::string& app_locale,
                                 FieldTypeSet* matching_types) const OVERRIDE;
   virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE;
   virtual void SetRawInfo(AutofillFieldType type,
                           const string16& value) OVERRIDE;
-  virtual string16 GetCanonicalizedInfo(AutofillFieldType type) const OVERRIDE;
-  virtual bool SetCanonicalizedInfo(AutofillFieldType type,
-                                    const string16& value) OVERRIDE;
+  virtual string16 GetInfo(AutofillFieldType type,
+                           const std::string& app_locale) const OVERRIDE;
+  virtual bool SetInfo(AutofillFieldType type,
+                       const string16& value,
+                       const std::string& app_locale) OVERRIDE;
   virtual void FillFormField(const AutofillField& field,
                              size_t variant,
                              FormFieldData* field_data) const OVERRIDE;
@@ -63,8 +66,8 @@
   // If the card numbers for |this| and |imported_card| match, overwrites |this|
   // card's data with the data in |credit_card| and returns true.  Otherwise,
   // returns false.
-  bool UpdateFromImportedCard(const CreditCard& imported_card)
-      WARN_UNUSED_RESULT;
+  bool UpdateFromImportedCard(const CreditCard& imported_card,
+                              const std::string& app_locale) WARN_UNUSED_RESULT;
 
   // Comparison for Sync.  Returns 0 if the credit card is the same as |this|,
   // or < 0, or > 0 if it is different.  The implied ordering can be used for
diff --git a/chrome/browser/autofill/form_group.cc b/chrome/browser/autofill/form_group.cc
index b814c42..42dd19c6a 100644
--- a/chrome/browser/autofill/form_group.cc
+++ b/chrome/browser/autofill/form_group.cc
@@ -11,6 +11,7 @@
 #include "base/logging.h"
 #include "base/string_number_conversions.h"
 #include "base/utf_string_conversions.h"
+#include "chrome/browser/autofill/autofill_country.h"
 #include "chrome/common/form_field_data.h"
 #include "grit/generated_resources.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -213,6 +214,7 @@
 }
 
 void FormGroup::GetMatchingTypes(const string16& text,
+                                 const std::string& app_locale,
                                  FieldTypeSet* matching_types) const {
   if (text.empty()) {
     matching_types->insert(EMPTY_TYPE);
@@ -226,27 +228,30 @@
     // TODO(isherman): Matches are case-sensitive for now.  Let's keep an eye on
     // this and decide whether there are compelling reasons to add case-
     // insensitivity.
-    if (GetRawInfo(*type) == text)
+    if (GetInfo(*type, app_locale) == text)
       matching_types->insert(*type);
   }
 }
 
-void FormGroup::GetNonEmptyTypes(FieldTypeSet* non_empty_types) const {
+void FormGroup::GetNonEmptyTypes(const std::string& app_locale,
+                                 FieldTypeSet* non_empty_types) const {
   FieldTypeSet types;
   GetSupportedTypes(&types);
   for (FieldTypeSet::const_iterator type = types.begin();
        type != types.end(); ++type) {
-    if (!GetRawInfo(*type).empty())
+    if (!GetInfo(*type, app_locale).empty())
       non_empty_types->insert(*type);
   }
 }
 
-string16 FormGroup::GetCanonicalizedInfo(AutofillFieldType type) const {
+string16 FormGroup::GetInfo(AutofillFieldType type,
+                            const std::string& app_locale) const {
   return GetRawInfo(type);
 }
 
-bool FormGroup::SetCanonicalizedInfo(AutofillFieldType type,
-                                     const string16& value) {
+bool FormGroup::SetInfo(AutofillFieldType type,
+                        const string16& value,
+                        const std::string& app_locale) {
   SetRawInfo(type, value);
   return true;
 }
@@ -263,7 +268,8 @@
   DCHECK_EQ("select-one", field->form_control_type);
   DCHECK_EQ(field->option_values.size(), field->option_contents.size());
 
-  string16 field_text = GetCanonicalizedInfo(type);
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
+  string16 field_text = GetInfo(type, app_locale);
   string16 field_text_lower = StringToLowerASCII(field_text);
   if (field_text.empty())
     return;
diff --git a/chrome/browser/autofill/form_group.h b/chrome/browser/autofill/form_group.h
index 807be86..edffeea 100644
--- a/chrome/browser/autofill/form_group.h
+++ b/chrome/browser/autofill/form_group.h
@@ -27,33 +27,37 @@
   virtual std::string GetGUID() const;
 
   // Used to determine the type of a field based on the text that a user enters
-  // into the field.  The field types can then be reported back to the server.
-  // This method is additive on |matching_types|.
+  // into the field, interpreted in the given |app_locale| if appropriate.  The
+  // field types can then be reported back to the server.  This method is
+  // additive on |matching_types|.
   virtual void GetMatchingTypes(const string16& text,
+                                const std::string& app_locale,
                                 FieldTypeSet* matching_types) const;
 
   // Returns a set of AutofillFieldTypes for which this FormGroup has non-empty
   // data.  This method is additive on |non_empty_types|.
-  virtual void GetNonEmptyTypes(FieldTypeSet* non_empty_types) const;
+  virtual void GetNonEmptyTypes(const std::string& app_locale,
+                                FieldTypeSet* non_empty_types) const;
 
   // Returns the string associated with |type|, without canonicalizing the
-  // returned value.  For user-visible strings, use GetCanonicalizedInfo()
-  // instead.
+  // returned value.  For user-visible strings, use GetInfo() instead.
   virtual string16 GetRawInfo(AutofillFieldType type) const = 0;
 
   // Sets this FormGroup object's data for |type| to |value|, without
   // canonicalizing the |value|.  For data that has not already been
-  // canonicalized, use SetCanonicalizedInfo() instead.
+  // canonicalized, use SetInfo() instead.
   virtual void SetRawInfo(AutofillFieldType type, const string16& value) = 0;
 
   // Returns the string that should be auto-filled into a text field given the
-  // type of that field.
-  virtual string16 GetCanonicalizedInfo(AutofillFieldType type) const;
+  // type of that field, localized to the given |app_locale| if appropriate.
+  virtual string16 GetInfo(AutofillFieldType type,
+                           const std::string& app_locale) const;
 
   // Used to populate this FormGroup object with data.  Canonicalizes the data
-  // prior to storing, if appropriate.
-  virtual bool SetCanonicalizedInfo(AutofillFieldType type,
-                                    const string16& value);
+  // according to the specified |app_locale| prior to storing, if appropriate.
+  virtual bool SetInfo(AutofillFieldType type,
+                       const string16& value,
+                       const std::string& app_locale);
 
   // Set |field_data|'s value based on |field| and contents of |this| (using
   // data variant |variant|). It is an error to call the default implementation.
diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc
index 387bc6dc..9f687bd6 100644
--- a/chrome/browser/autofill/personal_data_manager.cc
+++ b/chrome/browser/autofill/personal_data_manager.cc
@@ -15,6 +15,7 @@
 #include "chrome/browser/api/sync/profile_sync_service_base.h"
 #include "chrome/browser/api/webdata/autofill_web_data_service.h"
 #include "chrome/browser/autofill/autofill-inl.h"
+#include "chrome/browser/autofill/autofill_country.h"
 #include "chrome/browser/autofill/autofill_field.h"
 #include "chrome/browser/autofill/autofill_metrics.h"
 #include "chrome/browser/autofill/autofill_regexes.h"
@@ -243,6 +244,7 @@
   // complete at the end.
   PhoneNumber::PhoneCombineHelper home;
 
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
   for (size_t i = 0; i < form.field_count(); ++i) {
     const AutofillField* field = form.field(i);
     string16 value = CollapseWhitespace(field->value, false);
@@ -270,7 +272,7 @@
         DCHECK_EQ(CREDIT_CARD_EXP_MONTH, field_type);
         local_imported_credit_card->SetInfoForMonthInputType(value);
       } else {
-        local_imported_credit_card->SetCanonicalizedInfo(field_type, value);
+        local_imported_credit_card->SetInfo(field_type, value, app_locale);
       }
       ++importable_credit_card_fields;
     } else {
@@ -279,7 +281,7 @@
       // If the fields are not the phone fields in question home.SetInfo() is
       // going to return false.
       if (!home.SetInfo(field_type, value))
-        imported_profile->SetCanonicalizedInfo(field_type, value);
+        imported_profile->SetInfo(field_type, value, app_locale);
 
       // Reject profiles with invalid country information.
       if (field_type == ADDRESS_HOME_COUNTRY &&
@@ -295,8 +297,8 @@
     string16 constructed_number;
     if (!home.ParseNumber(imported_profile->CountryCode(),
                           &constructed_number) ||
-        !imported_profile->SetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER,
-                                                constructed_number)) {
+        !imported_profile->SetInfo(PHONE_HOME_WHOLE_NUMBER, constructed_number,
+                                   app_locale)) {
       imported_profile.reset();
     }
   }
@@ -320,7 +322,8 @@
     for (std::vector<CreditCard*>::const_iterator iter = credit_cards_.begin();
          iter != credit_cards_.end();
          ++iter) {
-      if ((*iter)->UpdateFromImportedCard(*local_imported_credit_card.get())) {
+      if ((*iter)->UpdateFromImportedCard(*local_imported_credit_card.get(),
+                                          app_locale)) {
         merged_credit_card = true;
         UpdateCreditCard(**iter);
         local_imported_credit_card.reset();
@@ -491,15 +494,16 @@
 
 void PersonalDataManager::GetNonEmptyTypes(
     FieldTypeSet* non_empty_types) {
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
   const std::vector<AutofillProfile*>& profiles = GetProfiles();
   for (std::vector<AutofillProfile*>::const_iterator iter = profiles.begin();
        iter != profiles.end(); ++iter) {
-    (*iter)->GetNonEmptyTypes(non_empty_types);
+    (*iter)->GetNonEmptyTypes(app_locale, non_empty_types);
   }
 
   for (ScopedVector<CreditCard>::const_iterator iter = credit_cards_.begin();
        iter != credit_cards_.end(); ++iter) {
-    (*iter)->GetNonEmptyTypes(non_empty_types);
+    (*iter)->GetNonEmptyTypes(app_locale, non_empty_types);
   }
 }
 
@@ -859,13 +863,14 @@
   // Set to true if |imported_card| is merged into the credit card list.
   bool merged = false;
 
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
   std::vector<CreditCard> credit_cards;
   for (std::vector<CreditCard*>::const_iterator card = credit_cards_.begin();
        card != credit_cards_.end();
        ++card) {
     // If |imported_card| has not yet been merged, check whether it should be
     // with the current |card|.
-    if (!merged && (*card)->UpdateFromImportedCard(imported_card))
+    if (!merged && (*card)->UpdateFromImportedCard(imported_card, app_locale))
       merged = true;
 
     credit_cards.push_back(**card);
diff --git a/chrome/browser/autofill/phone_number.cc b/chrome/browser/autofill/phone_number.cc
index e242521..e5027fa 100644
--- a/chrome/browser/autofill/phone_number.cc
+++ b/chrome/browser/autofill/phone_number.cc
@@ -8,6 +8,7 @@
 #include "base/string_number_conversions.h"
 #include "base/string_util.h"
 #include "base/utf_string_conversions.h"
+#include "chrome/browser/autofill/autofill_country.h"
 #include "chrome/browser/autofill/autofill_profile.h"
 #include "chrome/browser/autofill/autofill_type.h"
 #include "chrome/browser/autofill/field_types.h"
@@ -63,25 +64,9 @@
   if (type == PHONE_HOME_WHOLE_NUMBER)
     return number_;
 
-  UpdateCacheIfNeeded();
-  if (!cached_parsed_phone_.IsValidNumber())
-    return string16();
-
-  if (type == PHONE_HOME_NUMBER)
-    return cached_parsed_phone_.GetNumber();
-
-  if (type == PHONE_HOME_CITY_CODE)
-    return cached_parsed_phone_.GetCityCode();
-
-  if (type == PHONE_HOME_COUNTRY_CODE)
-    return cached_parsed_phone_.GetCountryCode();
-
-  if (type == PHONE_HOME_CITY_AND_NUMBER) {
-    string16 city_and_local(cached_parsed_phone_.GetCityCode());
-    city_and_local.append(cached_parsed_phone_.GetNumber());
-    return city_and_local;
-  }
-
+  // Only the whole number is available as raw data.  All of the other types are
+  // parsed from this raw info, and parsing requires knowledge of the phone
+  // number's region, which is only available via GetInfo().
   return string16();
 }
 
@@ -94,79 +79,110 @@
   }
 
   number_ = value;
-  cached_parsed_phone_ = autofill_i18n::PhoneObject(number_, GetRegion());
+
+  // Invalidate the cached number.
+  cached_parsed_phone_ = autofill_i18n::PhoneObject();
 }
 
 // Normalize phones if |type| is a whole number:
 //   (650)2345678 -> 6502345678
 //   1-800-FLOWERS -> 18003569377
 // If the phone cannot be normalized, returns the stored value verbatim.
-string16 PhoneNumber::GetCanonicalizedInfo(AutofillFieldType type) const {
-  string16 phone = GetRawInfo(type);
-  if (type != PHONE_HOME_WHOLE_NUMBER)
-    return phone;
+string16 PhoneNumber::GetInfo(AutofillFieldType type,
+                              const std::string& app_locale) const {
+  if (type == PHONE_HOME_WHOLE_NUMBER) {
+    // Whole numbers require special handling: If normalization for the number
+    // fails, return the non-normalized number instead.
+    string16 phone = GetRawInfo(type);
 
-  string16 normalized_phone = autofill_i18n::NormalizePhoneNumber(phone,
-                                                                  GetRegion());
-  if (!normalized_phone.empty())
-    return normalized_phone;
+    // TODO(isherman): Can/should this use the cached_parsed_phone_?
+    string16 normalized_phone =
+        autofill_i18n::NormalizePhoneNumber(phone, GetRegion(app_locale));
+    return !normalized_phone.empty() ? normalized_phone : phone;
+  }
 
-  return phone;
+  UpdateCacheIfNeeded(app_locale);
+  if (!cached_parsed_phone_.IsValidNumber())
+    return string16();
+
+  switch (type) {
+    case PHONE_HOME_NUMBER:
+      return cached_parsed_phone_.GetNumber();
+
+    case PHONE_HOME_CITY_CODE:
+      return cached_parsed_phone_.GetCityCode();
+
+    case PHONE_HOME_COUNTRY_CODE:
+      return cached_parsed_phone_.GetCountryCode();
+
+    case PHONE_HOME_CITY_AND_NUMBER:
+      return
+          cached_parsed_phone_.GetCityCode() + cached_parsed_phone_.GetNumber();
+
+    case PHONE_HOME_WHOLE_NUMBER:
+      NOTREACHED();  // Should have been handled above.
+      return string16();
+
+    default:
+      NOTREACHED();
+      return string16();
+  }
 }
 
-bool PhoneNumber::SetCanonicalizedInfo(AutofillFieldType type,
-                                       const string16& value) {
+bool PhoneNumber::SetInfo(AutofillFieldType type,
+                          const string16& value,
+                          const std::string& app_locale) {
   string16 number = value;
   StripPunctuation(&number);
   SetRawInfo(type, number);
 
-  return NormalizePhone();
+  if (number_.empty())
+    return true;
+
+  // Normalize the phone number by validating and translating it into a
+  // digits-only format.
+  UpdateCacheIfNeeded(app_locale);
+  number_ = cached_parsed_phone_.GetWholeNumber();
+  return !number_.empty();
 }
 
 void PhoneNumber::GetMatchingTypes(const string16& text,
+                                   const std::string& app_locale,
                                    FieldTypeSet* matching_types) const {
   string16 stripped_text = text;
   StripPunctuation(&stripped_text);
-  FormGroup::GetMatchingTypes(stripped_text, matching_types);
+  FormGroup::GetMatchingTypes(stripped_text, app_locale, matching_types);
 
   // For US numbers, also compare to the three-digit prefix and the four-digit
   // suffix, since web sites often split numbers into these two fields.
-  string16 number = GetCanonicalizedInfo(PHONE_HOME_NUMBER);
-  if (GetRegion() == "US" && number.size() == (kPrefixLength + kSuffixLength)) {
+  string16 number = GetInfo(PHONE_HOME_NUMBER, app_locale);
+  if (GetRegion(app_locale) == "US" &&
+      number.size() == (kPrefixLength + kSuffixLength)) {
     string16 prefix = number.substr(kPrefixOffset, kPrefixLength);
     string16 suffix = number.substr(kSuffixOffset, kSuffixLength);
     if (text == prefix || text == suffix)
       matching_types->insert(PHONE_HOME_NUMBER);
   }
 
-  string16 whole_number = GetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER);
-  if (!whole_number.empty() &&
-      autofill_i18n::NormalizePhoneNumber(text, GetRegion()) == whole_number) {
-    matching_types->insert(PHONE_HOME_WHOLE_NUMBER);
+  string16 whole_number = GetInfo(PHONE_HOME_WHOLE_NUMBER, app_locale);
+  if (!whole_number.empty()) {
+    string16 normalized_number =
+        autofill_i18n::NormalizePhoneNumber(text, GetRegion(app_locale));
+    if (normalized_number == whole_number)
+      matching_types->insert(PHONE_HOME_WHOLE_NUMBER);
   }
 }
 
-bool PhoneNumber::NormalizePhone() {
-  // Empty number does not need normalization.
-  if (number_.empty())
-    return true;
+std::string PhoneNumber::GetRegion(const std::string& app_locale) const {
+  const std::string country_code = profile_->CountryCode();
+  if (country_code.empty())
+    return AutofillCountry::CountryCodeForLocale(app_locale);
 
-  UpdateCacheIfNeeded();
-  number_ = cached_parsed_phone_.GetWholeNumber();
-  return !number_.empty();
+  return country_code;
 }
 
-std::string PhoneNumber::GetRegion() const {
-  if (!profile_) {
-    NOTREACHED();
-    return "US";
-  }
-
-  return profile_->CountryCode();
-}
-
-void PhoneNumber::UpdateCacheIfNeeded() const {
-  std::string region = GetRegion();
+void PhoneNumber::UpdateCacheIfNeeded(const std::string& app_locale) const {
+  std::string region = GetRegion(app_locale);
   if (!number_.empty() && cached_parsed_phone_.GetRegion() != region)
     cached_parsed_phone_ = autofill_i18n::PhoneObject(number_, region);
 }
@@ -215,8 +231,7 @@
   }
 
   return autofill_i18n::ConstructPhoneNumber(
-      country_, city_, phone_,
-      region,
+      country_, city_, phone_, region,
       (country_.empty() ?
           autofill_i18n::NATIONAL : autofill_i18n::INTERNATIONAL),
       value);
diff --git a/chrome/browser/autofill/phone_number.h b/chrome/browser/autofill/phone_number.h
index 192b4a83..a4ce5c647 100644
--- a/chrome/browser/autofill/phone_number.h
+++ b/chrome/browser/autofill/phone_number.h
@@ -29,13 +29,16 @@
 
   // FormGroup implementation:
   virtual void GetMatchingTypes(const string16& text,
+                                const std::string& app_locale,
                                 FieldTypeSet* matching_types) const OVERRIDE;
   virtual string16 GetRawInfo(AutofillFieldType type) const OVERRIDE;
   virtual void SetRawInfo(AutofillFieldType type,
                           const string16& value) OVERRIDE;
-  virtual string16 GetCanonicalizedInfo(AutofillFieldType type) const OVERRIDE;
-  virtual bool SetCanonicalizedInfo(AutofillFieldType type,
-                                    const string16& value) OVERRIDE;
+  virtual string16 GetInfo(AutofillFieldType type,
+                           const std::string& app_locale) const OVERRIDE;
+  virtual bool SetInfo(AutofillFieldType type,
+                       const string16& value,
+                       const std::string& app_locale) OVERRIDE;
 
   // Size and offset of the prefix and suffix portions of phone numbers.
   static const size_t kPrefixOffset = 0;
@@ -70,18 +73,16 @@
   // FormGroup:
   virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE;
 
-  // Validates |number_| and translates it into digits-only format.
-  bool NormalizePhone();
-
   // Returns the region code for this phone number, which is an ISO 3166
   // 2-letter country code.  The name "region" is chosen since "country code"
   // already refers to part of a phone number.  The returned value is based on
-  // the |profile_|.
-  std::string GetRegion() const;
+  // the |profile_|; if the |profile_| does not have a country code associated
+  // with it, falls back to the country code corresponding to the |app_locale|.
+  std::string GetRegion(const std::string& app_locale) const;
 
   // Updates the cached parsed number if the profile's region has changed
   // since the last time the cache was updated.
-  void UpdateCacheIfNeeded() const;
+  void UpdateCacheIfNeeded(const std::string& app_locale) const;
 
   // The phone number.
   string16 number_;
diff --git a/chrome/browser/autofill/phone_number_i18n.h b/chrome/browser/autofill/phone_number_i18n.h
index ad990efa..7b9a140 100644
--- a/chrome/browser/autofill/phone_number_i18n.h
+++ b/chrome/browser/autofill/phone_number_i18n.h
@@ -67,7 +67,7 @@
 
 bool PhoneNumbersMatch(const string16& number_a,
                        const string16& number_b,
-                       const std::string& country_code);
+                       const std::string& region);
 
 // The cached phone number, does parsing only once, improves performance.
 class PhoneObject {
diff --git a/chrome/browser/autofill/phone_number_unittest.cc b/chrome/browser/autofill/phone_number_unittest.cc
index df49d01..c2c77e1c 100644
--- a/chrome/browser/autofill/phone_number_unittest.cc
+++ b/chrome/browser/autofill/phone_number_unittest.cc
@@ -16,62 +16,65 @@
   // Set phone number so country_code == 1, city_code = 650, number = 2345678.
   string16 phone(ASCIIToUTF16("1 [650] 234-5678"));
   PhoneNumber phone_number(&profile);
-  phone_number.SetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER, phone);
+  phone_number.SetInfo(PHONE_HOME_WHOLE_NUMBER, phone, "US");
 
   FieldTypeSet matching_types;
-  phone_number.GetMatchingTypes(string16(), &matching_types);
+  phone_number.GetMatchingTypes(string16(), "US", &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(EMPTY_TYPE) != matching_types.end());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("1"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("1"), "US", &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(PHONE_HOME_COUNTRY_CODE) !=
               matching_types.end());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("16"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("16"), "US", &matching_types);
   EXPECT_EQ(0U, matching_types.size());
-  phone_number.GetMatchingTypes(ASCIIToUTF16("165"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("165"), "US", &matching_types);
   EXPECT_EQ(0U, matching_types.size());
-  phone_number.GetMatchingTypes(ASCIIToUTF16("1650"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("1650"), "US", &matching_types);
   EXPECT_EQ(0U, matching_types.size());
-  phone_number.GetMatchingTypes(ASCIIToUTF16("16502"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("16502"), "US", &matching_types);
   EXPECT_EQ(0U, matching_types.size());
-  phone_number.GetMatchingTypes(ASCIIToUTF16("165023"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("165023"), "US", &matching_types);
   EXPECT_EQ(0U, matching_types.size());
-  phone_number.GetMatchingTypes(ASCIIToUTF16("1650234"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("1650234"), "US", &matching_types);
   EXPECT_EQ(0U, matching_types.size());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("16502345678"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("16502345678"), "US",
+                                &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(PHONE_HOME_WHOLE_NUMBER) !=
               matching_types.end());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("650"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("650"), "US", &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(PHONE_HOME_CITY_CODE) !=
               matching_types.end());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("2345678"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("2345678"), "US", &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(PHONE_HOME_NUMBER) != matching_types.end());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("234"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("234"), "US", &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(PHONE_HOME_NUMBER) != matching_types.end());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("5678"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("5678"), "US", &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(PHONE_HOME_NUMBER) != matching_types.end());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("2345"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("2345"), "US", &matching_types);
   EXPECT_EQ(0U, matching_types.size());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("6502345678"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("6502345678"), "US",
+                                &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(PHONE_HOME_CITY_AND_NUMBER) !=
               matching_types.end());
   matching_types.clear();
-  phone_number.GetMatchingTypes(ASCIIToUTF16("(650)2345678"), &matching_types);
+  phone_number.GetMatchingTypes(ASCIIToUTF16("(650)2345678"), "US",
+                                &matching_types);
   EXPECT_EQ(1U, matching_types.size());
   EXPECT_TRUE(matching_types.find(PHONE_HOME_CITY_AND_NUMBER) !=
               matching_types.end());
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller.cc b/chrome/browser/ui/autofill/autofill_dialog_controller.cc
index ced7417..a97c5ab 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller.cc
@@ -6,6 +6,7 @@
 
 #include "base/string_util.h"
 #include "base/utf_string_conversions.h"
+#include "chrome/browser/autofill/autofill_country.h"
 #include "chrome/browser/autofill/autofill_manager.h"
 #include "chrome/browser/autofill/personal_data_manager.h"
 #include "chrome/browser/autofill/personal_data_manager_factory.h"
@@ -82,6 +83,8 @@
     const std::vector<T*>& sources,
     const DetailInputs* const* all_inputs,
     size_t all_inputs_length) {
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
+
   int best_field_fill_count = 0;
   FormGroup* best_source = NULL;
 
@@ -91,9 +94,8 @@
     for (size_t j = 0; j < all_inputs_length; ++j) {
       const DetailInputs& inputs = *all_inputs[j];
       for (size_t k = 0; k < inputs.size(); ++k) {
-        if (!sources[i]->GetCanonicalizedInfo(inputs[k].type).empty()) {
+        if (!sources[i]->GetInfo(inputs[k].type, app_locale).empty())
           field_fill_count++;
-        }
       }
     }
 
@@ -112,10 +114,11 @@
 void FillInputsFromFormGroup(FormGroup* group,
                              DetailInputs** all_inputs,
                              size_t all_inputs_length) {
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
   for (size_t i = 0; i < all_inputs_length; ++i) {
     DetailInputs& inputs = *all_inputs[i];
     for (size_t j = 0; j < inputs.size(); ++j) {
-      inputs[j].starting_value = group->GetCanonicalizedInfo(inputs[j].type);
+      inputs[j].starting_value = group->GetInfo(inputs[j].type, app_locale);
     }
   }
 }
@@ -348,8 +351,9 @@
   suggested_cc_.AddItem("", ASCIIToUTF16("Enter new card"));
 
   const std::vector<AutofillProfile*>& profiles = manager->GetProfiles();
+  const std::string app_locale = AutofillCountry::ApplicationLocale();
   for (size_t i = 0; i < profiles.size(); ++i) {
-    string16 email = profiles[i]->GetCanonicalizedInfo(EMAIL_ADDRESS);
+    string16 email = profiles[i]->GetInfo(EMAIL_ADDRESS, app_locale);
     if (!email.empty())
       suggested_email_.AddItem(profiles[i]->guid(), email);
     suggested_billing_.AddItem(profiles[i]->guid(), profiles[i]->Label());